Generate ssh key pair
ssh-keygen -t rsa -b 2048 -f ~/.ssh/id_rsa_github -C "127.0.0.1"
ssh-keygen -t rsa -b 2048 -f ~/.ssh/id_rsa_gitlab -C "127.0.0.1"
Upload the *.pub to Github / Gitlab respectively.
Map ssh keys
vi ~/.ssh/config
Host github
HostName github.com
User git
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_github
Host gitlab
HostName gitlab.com
User git
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_gitlab
Test connectivity
ssh -T [email protected]
ssh -T [email protected]