Skip to content

Instantly share code, notes, and snippets.

@hugomrdias
Forked from sindresorhus/.profile
Last active August 22, 2018 10:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hugomrdias/0092a533d7bd87cadd0647f1985d6ca5 to your computer and use it in GitHub Desktop.
Save hugomrdias/0092a533d7bd87cadd0647f1985d6ca5 to your computer and use it in GitHub Desktop.
Automatic Git commit signing with GPG on OSX
# Connects gpg-agent to the OSX keychain via the brew-installed
# pinentry program from GPGtools. This is the OSX 'magic sauce',
# allowing the gpg key's passphrase to be stored in the login
# keychain, enabling automatic key signing.
pinentry-program /usr/local/bin/pinentry
# A quick outline of what must be done to get everything working.
# 1) Install the dependencies.
brew install gnupg pinentry-mac
# 2) Configure git to automatically gpgsign commits. This consists of
# pointing git to your signing key ID, and then enabling commit
# automatic signing.
git config --global user.signingkey <YOUR-SIGNING-KEY-PUB-ID>
git config --global commit.gpgsign true
# 3) Configure the GPG components (see above for relevant examples):
# ~/.gnupg/gpg.conf
# ~/.gnupg/gpg-agent.conf
# Don't forget to upload your public key to Github!
# https://github.com/blog/2144-gpg-signature-verification
# Note: There needs to be a three-way match on your email for Github to show
# the commit as 'verified': The commit email, github email, & the email associated with the public key
# Learn about creating a GPG key and the knowledge behind these commands here:
# https://git-scm.com/book/en/v2/Git-Tools-Signing-Your-Work
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment