NOTE: Needs Git 2.34.0 or later
touch ~/.ssh/allowed_signers
chmod 600 ~/.ssh/allowed_signers
echo "<your name here> $(cat ~/.ssh/id_rsa.pub)" >> ~/.ssh/allowed_signers
[user]
signingkey = ~/.ssh/id_rsa.pub
[gpg]
program = gpg
format = ssh
[commit]
gpgsign = true
[gpg "ssh"]
allowedSignersFile = ~/.ssh/allowed_signers
$ git commit -m "Test SSH signing" --allow-empty
[111222333-some-branch 78737f63f6] Test SSH signing
$ git log --show-signature -1
commit 78737f63f64bfd9f25d79f00fff1a481ed8b8f45 (HEAD -> 111222333-some-branch)
Good "git" signature for <SNIP> with RSA key SHA256:<---SNIP--->
Author: <SNIP> <--SNIP--->
Date: Wed Nov 27 18:28:59 2024 +0100
Test SSH signing
References