Per-repo SSH keys for Git with core.sshCommand

If you keep more than one GitHub (or GitLab, or whatever) identity, you usually end up with more than one private key. The usual fixes are Host aliases in ~/.ssh/config, or typing GIT_SSH_COMMAND='ssh -i ~/.ssh/some_key -o IdentitiesOnly=yes' git … before every command. Both work. Neither is what I want when I just opened a random repo in a deep path and want my fingers to do the right thing. Reminder: you can pin the SSH command on a single clone: ...

August 2, 2023 · 1 min · 206 words