Skip to content

Instantly share code, notes, and snippets.

@michaelbrawn
Forked from danieleggert/GPG and git on macOS.md
Last active December 11, 2018 15:45
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 michaelbrawn/1e2c9def210dcf56827498fa6a143115 to your computer and use it in GitHub Desktop.
Save michaelbrawn/1e2c9def210dcf56827498fa6a143115 to your computer and use it in GitHub Desktop.
How to set up git to use the GPG Suite

GPG and git on macOS

Setup

brew cask install gpg-suite "/usr/local/Caskroom/gpg-suite/{{version}}/Install.pkg"

  1. Run gpg --list-secret-keys and look for sec, use the key ID for the next step
  2. Configure git to use GPG -- replace the key with the one from gpg --list-secret-keys --keyid-format LONG
git config --global gpg.program /usr/local/MacGPG2/bin/gpg2
git config --global user.signingkey {{sec value}} 
git config --global commit.gpgsign true 
  1. Optionally configure annotated tags to be GPG signed
git config --global tag.forceSignAnnotated true
  1. Add this line to ~/.gnupg/gpg.conf
no-tty

Add public GPG key to GitHub

open https://github.com/settings/keys
open /Applications/GPG\ Keychain.app
# Copy your public GPG key

See Also

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment