Skip to content

Instantly share code, notes, and snippets.

@geeky-sh
Created June 16, 2016 17:56
Show Gist options
  • Save geeky-sh/5a3f8beb24ff7525fe4e745e1e9d4714 to your computer and use it in GitHub Desktop.
Save geeky-sh/5a3f8beb24ff7525fe4e745e1e9d4714 to your computer and use it in GitHub Desktop.
How to add multiple ssh keys for multiple github accounts on a single machine
ssh-keygen -t rsa -b 4096 -C "aash.discover@gmail.com"
## when prompted for file name, take id_rsa_personal
ssh-keygen -t rsa -b 4096 -C "aash@workmail.com"
# when prompted for file name, take id_rsa_work
## below are the content of ~/.ssh/config
Host personalid.github.com
Hostname github.com
PreferredAuthentications publickey
IdentityFile /Users/aash/.ssh/id_rsa_personal
Host workid.github.com
Hostname github.com
PreferredAuthentications publickey
IdentityFile /Users/aash/.ssh/id_rsa_work
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment