Find signingkey

Assuming you already have a GPG key:

gpg --list-secret-keys --keyid-format LONG

Output looks like this:

sec   rsa2048/1234567890123456 2018-09-01 [SC] [verfällt: 2019-09-01]
uid              [ ultimativ ] Andreas Mausch <>
ssb   rsa2048/12345BEFBD9E7997 2018-09-01 [E] [verfällt: 2019-09-01]

In this case, 1234567890123456 would be your signingkey you need to configure in git.

Configure git user.signingkey

git config user.signingkey 1234567890123456

Sign commits

In order to sign your commits, you can either use the -S command option:

git commit -S -m "My commit msg"

Or the method I personally prefer, to tell git to sign all commits automatically:

git config commit.gpgsign true