In Mercurial, I can specify the command (and thus the certificate) used for SSH per-repository in .hg/hgrc, for example:
[ui]
...
ssh = "C:\path\to\ssh.exe" -i "C:\Development\Identities\identity1.id_rsa"
Most instructions I can find on configuring Git seem to use the bundled ssh.exe to manage the certificates, for example GitHub’s guide for Windows. There is a way of specifying a script for Git to use for SSL (here under “No supported authentication methods available”) via an environment variable, but that per user and not granular enough for me.
How can I specify a per-repository SSH command line in Git?
I’m unaware of a way to make
gitdo this. Butsshshould be flexible enough to do it instead.First note that you can specify more than one identity file. It will try multiple identities in turn, until one is accepted.
Second, under unix, if you want only certain identities to be tried for certain hosts, you can do so by modifying
~/.ssh/configto have stanzas such as:Though I don’t know if that will work for your bundled windows ssh client, or where the config file goes, if it does.
EDIT: if you want to use two different identities on the same host, that can be done too:
and use and as the hosts in
git(there is substantial support to treat one host as another, or do even stronger rewriting with config options such asurl.<base>.insteadOf.