I have two github accounts, one is personal and second one is work related. I am doing a 'command line' git commit to my personal repo, but it is still showing the 'work' account, throws Permission to personalaccount/sample.git
denied to someworkaccount
. How do I switch the work account to personal one ?
Asked
Active
Viewed 819 times
2

soccerway
- 10,371
- 19
- 67
- 132
-
1Does this answer your question? [Multiple github accounts on the same computer?](https://stackoverflow.com/questions/3860112/multiple-github-accounts-on-the-same-computer) – phd Feb 12 '20 at 21:27
-
https://stackoverflow.com/search?q=%5Bgit%5D+multiple+accounts – phd Feb 12 '20 at 21:27
1 Answers
0
Check your git config credential.helper
config: if it returns manager, that means the credentials (username/password) are cached.
Type git credential-manager reject https://github.com
, as explained here.
The next push will ask for your username/password again.

VonC
- 1,262,500
- 529
- 4,410
- 5,250
-
This can also be acheived with setting up SSH keys right ? One for Work Account, One for Personal ? – Zunaib Imtiaz Feb 13 '20 at 05:55
-
@ZunaibImtiaz Yes, as I explain in https://stackoverflow.com/a/55274407/6309. But I am answering here the HTTPS aspect, not SSH. – VonC Feb 13 '20 at 05:58
-
-
$ git credential.helper git: 'credential.helper' is not a git command. See 'git --help' ..sorry if i am wrong .. – soccerway Feb 13 '20 at 06:31
-
1@soccerway Sorry, it was `git config credential.helper`. I have edited the answer accordingly. – VonC Feb 13 '20 at 07:00
-
I have navigated to control panel > credential manager > remove windows credential for gitHub manually..Then while pushing my commits, it ask me to enter credentials...which worked out luckly... – soccerway Feb 13 '20 at 07:03
-
So if I run the `git credential-manager reject https://github.com` will it remove all of the GitHub credentials of other GitHub accounts in one system ? – soccerway Feb 13 '20 at 07:05
-
@soccerway There is only one credential associated to (and cached for) github.com at any given time. A reject will remove that one credential. – VonC Feb 13 '20 at 07:42