Skip to main content

Using different SSH-Keys

Category: Git
git-logo

By using SSH-Aliases you can easily use an alternative key for one host. This may be neccessary if you want to access different Bitbucket- or GitHub-Accounts.

First we need to define an alias:

nano ~/.ssh/config

 

Host work
 HostName bitbucket.org
 IdentityFile ~/.ssh/id_rsa_work

Finally just clone the repository using the alias.

git clone git@work:repo.git