Skip to content

Instantly share code, notes, and snippets.

@Couto
Last active August 29, 2015 14:00
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 Couto/e8d0f49716cb2a75603a to your computer and use it in GitHub Desktop.
Save Couto/e8d0f49716cb2a75603a to your computer and use it in GitHub Desktop.
SSH Configuration to allow multiple SSH keys for deployment
Host projectname github.com
Hostname github.com
IdentityFile /home/{{username}}/.ssh/deploy_key_projectname
#User username-on-remote-machine
Host projectname2 bitbucket.org
Hostname bitbucket.org
IdentityFile /home/{{username}}/.ssh/deploy_key_projectname2
#User username-on-remote-machine
@Couto
Copy link
Author

Couto commented Jul 10, 2014

  1. Replace {{username}} with the name of the user that will deploy the projects
  2. Clone the projects using the defined name

git clone git@projectname:OrganizationName/project.git
git clone git@projectname2:UserName/project2.git

this way the correct ssh key is used for each project

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