- Generate your key
gpg --full-generate-key
- Export the key, copy the output and add it to github's gpg keys section
gpg --armor --export <key-id>
- Turn on commit signature and set default signing key
git config --global commit.gpgsign true
git config --global user.signingKey <key-id>
To get key id, run:
gpg --list-secret-keys --keyid-format LONG
In the output:
/home/user/.gnupg/pubring.kbx
---------------------------------
sec rsa4096/XXXXXXXXXXXXXXXX 2021-05-21 [SC]
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
uid [ultimate] Jane doe <[email protected]>
ssb rsa4096/<key-id-here> 2021-05-21 [E]