Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
signing git commits with GPG keys.
# generate a key if you don't have one already
gpg --full-gen-key
# list the keys in long format and copy the key id after sec rsa4096/<KEY>
gpg --list-secret-keys --keyid-format LONG
# export the public key and post into your git profile (ui)
gpg --armor --export 127CAA89CEA6BE66
# update the global git configs,
git config --global user.signingkey 127CAA89CEA6BE66
git config --global commit.gpgsign true
# update your GPG_TTY
echo 'export GPG_TTY=$(tty)' >> ~/.bash_profile
#do a git commit and it should prompt you for your gpg password.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment