Skip to content

Instantly share code, notes, and snippets.

@kdembler
Last active September 16, 2020 10:00
Show Gist options
  • Save kdembler/a75786030b5acdac37248631990045ad to your computer and use it in GitHub Desktop.
Save kdembler/a75786030b5acdac37248631990045ad to your computer and use it in GitHub Desktop.
Setting up gpg commit signing on macOS

Set up GPG on macOS

Setup:

brew install gnupg2
gpg --import private.key

brew install pinentry-mac
echo "pinentry-program /usr/local/bin/pinentry-mac" > ~/.gnupg/gpg-agent.conf
killall gpg-agent

Git config:

git config --global commit.gpgSign true
git config --global gpg.program gpg

git commit -am 'My signed commit'

Export keys:

gpg -a --export-secret-keys dev@kdembler.com --output private.key
gpg --export-ownertrust > ownertrust.txt

Import keys:

gpg --import private.key
gpg --import-ownertrust ownertrust.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment