Using Different Key for GitHub Push

If your default id_rsa key is different than the one you use for GitHub, it's still possible to use simple git push regardless. Trick is in adding mapping to identity file in ~/.ssh/config:

~/.ssh/config
Host github.com
User git
IdentityFile ~/.ssh/id_rsa_github
IdentitiesOnly yes

This will ensure all communication with github.com uses id_rsa_github key.

Leave a Reply

Your email address will not be published. Required fields are marked *