Skip to content

Instantly share code, notes, and snippets.

@DoumanAsh
Created May 14, 2019 08:47
Show Gist options
  • Save DoumanAsh/b01af6de04b74b7ffbac8ba9b41d14ef to your computer and use it in GitHub Desktop.
Save DoumanAsh/b01af6de04b74b7ffbac8ba9b41d14ef to your computer and use it in GitHub Desktop.
ssh config for multiple keys to the same host (e.g. github)
# Personal GitHub account
Host github.com
HostName github.com
User git
AddKeysToAgent yes
IdentityFile ~/.ssh/id_rsa
# Work GitHub account
Host github.com-work
HostName github.com
User git
AddKeysToAgent yes
IdentityFile ~/.ssh/id_rsa_work
@DoumanAsh
Copy link
Author

With this config you can access github using personal ssh key as github.com
While work key will allow you to access it using github.com-wok

E.g. pull repo using work ssh key:

git clone [email protected]:<org>/<work-name>.git

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment