Re:Use multiple Git SSH identities on a single computer
by fastest963 on Thursday July 20, 2023 @07:32AM
(#36799088)
This doesn't work if you're using an agent like 1Password though and it doesn't handle signing commits with the right key either.
[ Parent
| on HN ]
Re:Use multiple Git SSH identities on a single computer
by perdjesk on Thursday July 20, 2023 @10:20AM
(#36800853)
Using git-config it is possible to configure per directory/remote URL different signing keys.
[includeIf "gitdir:~/work/client1/"]
path = ~/work/client1/.gitconfig
[includeIf "gitdir:~/work/client2/"]
path = ~/work/client2/.gitconfig
$ cat ~/work/client1/.gitconfig
[user]
email = emailforclient1
name = nameforclient1
signingKey = 3AA5C34371567BD2
[core]
sshCommand = ssh -i ~/.ssh/id_client1
$ cat ~/work/client2/.gitconfig
[user]
email = emailforclient2
name = nameforclient2
signingKey = 4BB6D45482678BE3
[core]
sshCommand = ssh -i ~/.ssh/id_client2
See:- https://news.ycombinator.com/item?id=36798978
- https://git-scm.com/docs/git-config#Documentation/git-config...