-
-
Save reejosamuel/a40ca4dd021ab9c6a53b85c512a4f8b8 to your computer and use it in GitHub Desktop.
Automatic Git commit signing with GPG on OSX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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-mac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Uncomment within config (or add this line) | |
use-agent | |
# This silences the "you need a passphrase" message once the passphrase handling is all set. | |
# Use at your own discretion - may prevent the successful interactive use of some operations. | |
# It is working fine for my use cases though. | |
batch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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. | |
# if more than one key then | |
# 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): | |
# location here | |
~/.gnupg/gpg.conf | |
~/.gnupg/gpg-agent.conf | |
# restart the service once the configurations are updated | |
killall gpg-agent | |
gpg-agent --deamon | |
# 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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment