Reputation: 4331
I would like to use different rsa keys for the same host when connecting to different git repositories on this host.
For example I have 2 git repositories on example.com:
[email protected]:rep1
and
[email protected]:rep2
The typical method for using 2 different RSA keys is for different hosts ~/.ssh/config :
Hostname example.com
User git
IdentityFile ~/.ssh/key1
This does not work for me, since both repositories are hosted on the same host.
Do you have any suggestions?
Upvotes: 1
Views: 129
Reputation: 42337
You can use the Host
keyword:
Host host1
HostName git.example.com
User git
IdentityFile ~/.ssh/key1
Host host2
HostName git.example.com
User git
IdentityFile ~/.ssh/key2
And then use ssh host1
or ssh host2
instead of using full host name.
Upvotes: 2