ylliX - Online Advertising Network

Quick tip: using git with multiple ssh keys

Probably you are using git. And probably a day when you will add another repo is close. But standard git behavior is to use key located at ~/.ssh/id_rsa. And you just generated ~/.ssh/mynewkey and want to using for your gitserver.com host. So what to do? Just edit your ~/.ssh/config (if you don’t have it yes, create empty) and put:

Host gitserver.com
Hostname gitserver.com
IdentityFile ~/.ssh/mynewkey
IdentitiesOnly yes

And this is it, git clone should use mynewkey instead of id_rsa

Leave a Reply