I like to use a dedicated SSH identity for different authenticators. For example I have a dedicated SSH key each for github and gitlab.
GIT_SSH_COMMAND='ssh -i ~/.ssh/github' git clone git@github.com:github/docs.git
You can set it each time
GIT_SSH_COMMAND='ssh -i ~/.ssh/github' git fetch
If you use the same key for all your interactions with the remote you can configure it
git config core.sshCommand 'ssh -i ~/.ssh/github'
The environment variable takes precedent so you can override the configured command if need be.
Is there something missing here? Let me know!
Want to stay up to date with Git for Pragmatists? 📬
Sign up for our mailing list!