How to sign git commits with SSH keys

To sign git commits globally across every repository using your SSH key, set:

git config --global gpg.format ssh
git config --global user.signingkey ~/.ssh/id_ed25519
git config --global commit.gpgsign true

To do the same per repo, omit the --global flag.

References