Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moisei/c0ae02744a5549b769435819328ea1d6 to your computer and use it in GitHub Desktop.
Save moisei/c0ae02744a5549b769435819328ea1d6 to your computer and use it in GitHub Desktop.
how to use separate private keys for github bitbucket and other users
https://superuser.com/questions/232373/how-to-tell-git-which-private-key-to-use
~/.ssh/config
host bitbucket.org
HostName bitbucket.org
IdentityFile ~/.ssh/github_rsa
User git
https://medium.com/@xiaolishen/use-multiple-ssh-keys-for-different-github-accounts-on-the-same-computer-7d7103ca8693
github.com-work
^^^^^^ add -work suffix to the url according to user name work
git@github.com-work:[my work GitHub group]/[my project].git
# Personal GitHub account
Host github.com
HostName github.com
User git
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
# Work GitHub account
Host github.com-work
HostName github.com
User git
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/work_rsa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment