Skip to content

Instantly share code, notes, and snippets.

@vitalymak
Forked from bmhatfield/.profile
Created November 3, 2019 11:58
Show Gist options
  • Select an option

  • Save vitalymak/2704232fd939ffc5e44c47089e0e7e3b to your computer and use it in GitHub Desktop.

Select an option

Save vitalymak/2704232fd939ffc5e44c47089e0e7e3b to your computer and use it in GitHub Desktop.
Automatic Git commit signing with GPG on OSX
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else
eval $(gpg-agent --daemon --write-env-file ~/.gnupg/.gpg-agent-info)
fi
# Enables GPG to find gpg-agent
use-standard-socket
# Connects gpg-agent to the OSX keychain via the brew-installed
# pinentry program from GPGtools
pinentry-program /usr/local/bin/pinentry-mac
# Uncomment within config (or add this line)
use-agent
brew install gnupg gpg-agent pinentry-mac
# 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
git config --global user.signingkey <YOUR-SIGNING-KEY-PUB-ID>
git config --global commit.gpgsign true
# Don't forget to upload your keys to Github!
# https://github.com/blog/2144-gpg-signature-verification
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment