Graeme Benzie Graeme Benzie - 5 months ago 29
Git Question

Need to switch from personal to work git account

I have have been using my personal git and github accounts on my work computer Windows10 but would like to start using work accounts instead.

I have created a new work account and repository on github. After cloning the repository to my local machine, making a commit and then trying to push I get the following error.

git push
! [remote rejected] release -> release (permission denied)
error: failed to push some refs to

I am using VS Code

If I run

git config --get

I get my work email

Within the terminal in VS Code

git remote -v
origin (fetch)
origin (push)

What do I need to do so I can push to my work repo on github


Answer Source

You tried to push to the https link of your repo and that won't work (without manually typing your username and password). You have to use the ssh version of the link!

To change the link for the remote origin open a console in the directory of your repo and type:

git remote set-url origin

Now you should be able to push to github.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download