Skip to content

Multi SSH key for github & gitlab

Question

How to manage and store multiple SSH key for github, gitlab and bitbucket?

## add each SSH private key to the SSH agent
ssh-add ~/.ssh/id_rsa_github
ssh-add ~/.ssh/id_rsa_gitlab

edit ~/.ssh/config file

   # GitHub account
   Host github.com
     HostName github.com
     User git
     IdentityFile ~/.ssh/id_rsa_github

   # GitLab account
   Host gitlab.com
     HostName gilab.com
     User git
     IdentityFile ~/.ssh/id_rsa_gitlab

test

ssh -T [email protected]
ssh -T git@github-secondaccount
Feedback