How to use two GitHub accounts on the same computer using two users in windows?

Viewed 56

I am using two users in my windows pc and both the users need git while they have different accounts on GitHub. so how can I fix this? is there a way that both of us can use two accounts on the same pc

I tried to do this where they changed the configuration file but my new user doesn't have the file

thanks in advance!!

1 Answers

If those are two different account on your PC, they have each their %USERPROFILE%/$HOME.

That means each one can create their own SSH key (ssh-keygen -t rsa -P "") and register the %USERPROFILE%\.ssh\id_rsa.pub to their respective GitHub profile.
No need for a %USERPROFILE%\.ssh\config in that case.


If you have only one logged on user on your PC, but need to push as two different users, then yes:

  • create two different key pairs (ssh-keygen -t rsa -P "" -f key1 and ssh-keygen -t rsa -P "" -f key2, in a created %USERPROFILE%\.ssh)
  • create a %USERPROFILE%\.ssh\config as you have seen.
Related