GPG-Keys

Generate Primary GPG Key

Follow the Prompts (make sure to backup revoke certificate)

gpg --full-generate-key

List Private Keys

gpg -K

List Public Keys

gpg -k

Generate Revoke Certificate Manually

gpg --output mykey-revoke.asc --gen-revoke mykey

Get Key Signatures (last # of key id)

gpg --list-signatures

Importing and getting GPG Private keys to work with git signing

Import private key

gpg --import private-key

Can test if it works (most likely won't) by using this:

echo "test" | gpg --clearsig

Get listed keys and note the ID of the imported key (should say [unknown])

gpg -K

Edit the key and trust it (enter 5, then y)

gpg --edit-key <KEYID> trust quit

Ensure the ~/.gnupg is owned by user and chmod -ed correctly

chown -R $(whoami) ~/.gnupg/
chmod 600 ~/.gnupg/*
chmod 700 ~/.gnupg

Restart gpg-agent

systemctl --user stop gpg-agent
systemctl --user start gpg-agent

or

systemctl --user restart gpg-agent

add to .bashrc, then source .bashrc

export GPG_TTY=$(tty)

this also usually solves the gpg: signing failed: Inappropriate ioctl for device

Sign Git Commits with GPG Key

git config --global commit.gpgsign true
git config --global tag.gpgSign true

Get signature

gpg --list-signatures
git config --global user.signingkey {your-key-signature}
git config --global user.email email@emailplace.com
git config --global user.name John Smith

gpg: [stdin]: clear-sign failed: No pinentry

Install pinentry

sudo yum install pinentry