read this first https://docs.github.com/en/github/authenticating-to-github/managing-commit-signature-verification/generating-a-new-gpg-key
to better copy key use
gpg --armor --export <key_ID> > key.txt
open key.txt
from notepad and use it in github
read this for adding GPG key to github https://docs.github.com/en/github/authenticating-to-github/managing-commit-signature-verification/adding-a-new-gpg-key-to-your-github-account
- first make GitHub know which software to use
git config --global gpg.program "/usr/bin/gpg"
- then say what key to use with KEY ID (ID of the onw which uploaded in git)
git config --global user.signingkey <KEY_ID>
- enable signing globally
git config --global commit.gpgsign true
- for single repo
-
- cd to your repo
cd /path/to/repo
then
- cd to your repo
git config commit.gpgsign true