Software Projects

Using an SSH config file to git-push to use the right SSH key for multiple domains

Posted in Uncategorized by rmt on August 27, 2012

Use a file called config in your .ssh directory to direct ssh/git to use the correct ssh public key, depending on which domain you connect to.

An example that uses the correct SSH key when using git push to save code to either GitHub or Heroku:


Host github.com
  IdentityFile C:\Users\Robert\Documents\keystore\github-id_rsa
Host heroku.com
  IdentityFile C:\Users\Robert\Documents\keystore\heroku-pc2-id_rsa

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s