- Generate a key in
~/.ssh
withssh-keygen
- Go to gitlab/github and add the public key.
- Update or add the
~/.ssh/config
file with:
Host gitlab.com:username
IdentityFile /home/user/.ssh/gitlab
Host github.com:username
IdentityFile /home/user/.ssh/github
eval $(ssh-agent)
ssh-add ~/.ssh/gitlab
- Push!
-- On osx easy copying of keys: cat gitlab.pub | pbcopy