Configuring SSH Keys for Multiple GitHub Accounts
Configuring SSH Keys for Multiple GitHub Accounts
Use Different Host values
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_fry_ed25519
Host github-plnx
HostName github.com
User git
IdentityFile ~/.ssh/id_fry_plnx_ed25519
# Instead of the actual URL
$ git clone git@github.com:planet-express/delivery_service.git
# Substitue in our custom Host value for the `github.com` part
$ git clone git@github-plnx:planet-express/delivery_service.git
Automate Substituting the Host
[include]
path = ~/.gitconfig_custom
# See custom `Host github-plnx` in ~/.ssh/config
[url "github-plnx:planet-express"]
insteadOf = git@github.com:planet-express