I have a number of git repos on remote systems (e.g. GitLab) where my laptop’s pub key is already registered for a certain other account not associated with the aforementioned git repos.

Thus, I usually have to GIT_SSH_COMMAND='ssh -i <path/to/some/private/key>' git <command> so as to communicate with these repos under the correct identity.

I might be a slowpoke, but after the 500th time doing so, I learned that I could do this:

git config core.sshCommand "ssh -i /path/to/some/private/key"

to save myself from having to provide that env var every.damn.time.

And after the 1000th time doing so, I decided to blog it down so my muscle memory can make room for other stuff.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s