I have created two GitHub accounts. One for my work user and one for my personal self. I needed to do catch up on some work and as such cloned my work repo onto my personal PC
You can create one more key pair, say id_rsa_personal.pub
, and add it to the Github account.
Next, create/edit the .ssh/config
file.
# Default GitHub
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa
Host github-public
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_public
Host github-personal
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_personal
The above file will help you to use more than one Github account. For background info, refer to the answers to this question.
Next, you will need to alter your .git/config
remote url to point to:
git@github-personal:
Rather than the usual:
git@github.com: