Skip to content

Instantly share code, notes, and snippets.

@leighghunt
Created November 7, 2016 01:49
Show Gist options
  • Save leighghunt/971d428f7bc30728bdb51c27a7974090 to your computer and use it in GitHub Desktop.
Save leighghunt/971d428f7bc30728bdb51c27a7974090 to your computer and use it in GitHub Desktop.
Multiple github deploy keys on one server

vim ~/.ssh/config

Host <site-prefix-1>.github.com
  HostName github.com
  User git
  IdentityFile /c/Users/Administrator/.ssh/<site-prefix-1>.id_rsa
  IdentitiesOnly yes

Host <site-prefix-2>.github.com
  HostName github.com
  User git
  IdentityFile /c/Users/Administrator/.ssh/<site-prefix-2>.id_rsa
  IdentitiesOnly yes
ssh-keygen -t rsa -b 4096 -C "[email protected]"

...

mv ~/.ssh/id_rsa.pub ~/.ssh/<site-prefix-n>.id_rsa.pub
mv ~/.ssh/id_rsa ~/.ssh/<site-prefix-n>.id_rsa
git clone git@<site-prefix-n>.github.com:<username>/<repo>.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment