At work, I use both my companies internal GitLab and my personal GitHub account. This requires multiple ssh keys for accessing each respective account.
Under Linux, this requires a ~/.ssh/config file, with a similar setup to the following:
Host github.com User jonathan IdentityFile ~/.ssh/id_rsa_github Host * User jonathan IdentityFile ~/.ssh/id_rsa
In the above, I have a specific key for my GitHub account and a default key which I use to service my company’s internal GitLab. This behaviour overrides the settings in the default ssh_config file. There are various other parameters configurable as required.
- Port
- Protocol
- LocalForward
The man pages are very helpful in this regard.
Helpful Resources: