Re:Sign arbitrary data with your SSH keys
by WesolyKubeczek on Saturday November 13, 2021 @11:15AM
(#29210798)
I guess you also need
IdentitiesOnly yes
in there.Otherwise all your public keys will be tried regardless.
Re:Sign arbitrary data with your SSH keys
by drothlis on Sunday November 14, 2021 @07:23AM
(#29216804)
Another way is to set $GIT_SSH_COMMAND when cloning:
GIT_SSH_COMMAND="ssh -i ~/.ssh/id_ed25519_company_a -o IdentitiesOnly=yes" git clone ...
and then set it in your checkout's .git/config for subsequent fetches & pushes: git config core.sshCommand "ssh -i ~/.ssh/id_ed25519_company_a -o IdentitiesOnly=yes"
I agree. The way that I deal with this is as follows:
In my ~/.ssh/config I have content that looks like:
And then instead of I'd type Likewise, instead of I do and so on.With this way of doing it, the correct key pair gets used both for the initial clone and for subsequent pulls and pushes.
I suppose I could make a wrapper program that would take care of the substitution for me, to further reduce the amount of hassle. In fact I might end up doing that. I already have a few wrapper programs for various git commands.