Manage multiple SSH key for github and gitlab

TL;DR

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 git@github.com
ssh -T git@github-secondaccount
Leave a message