How to use different keys for different git servers?

I have access to different git servers. I have several keys for these servers. How to use different keys for different git servers?

asked Jan 24, 2014 by anonymous

1 Answer

 
Best answer

Use the .ssh/config file to specify different configuration for different SSH servers used by git:

For example:

Host git.example.org
  Port 22111
  IdentityFile ~/.ssh/id_rsa.git.example.org

Host code.example.org
  Port 22
  IdentityFile ~/.ssh/id_rsa.code.example.org

which specifies the port and private key file for git.example.org and code.example.org.

answered Jan 26, 2014 by anonymous

Please log in or register to answer this question.

Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost

...