Skip to content

Instantly share code, notes, and snippets.

@mlafeldt
Last active July 4, 2016 09:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mlafeldt/5ac4e46391ea7864acadafa65be9f331 to your computer and use it in GitHub Desktop.
Save mlafeldt/5ac4e46391ea7864acadafa65be9f331 to your computer and use it in GitHub Desktop.
How to sign Git commits using GPG under OSX
brew install gpg-agent
  • Add this to your .bashrc
# https://blog.chendry.org/2015/03/13/starting-gpg-agent-in-osx.html
[ -f ~/.gpg-agent-info ] && source ~/.gpg-agent-info
if [ -S "${GPG_AGENT_INFO%%:*}" ]; then
  export GPG_AGENT_INFO
else
  eval $(gpg-agent --daemon --write-env-file ~/.gpg-agent-info)
fi
# http://forums.fedoraforum.org/archive/index.php/t-234903.html
export GPG_TTY=$(tty)
  • Configure gpg to use gpg-agent
$ cat .gnupg/gpg.conf
use-agent
  • Configure gpg-agent to cache passwords for 8h:
$ cat .gnupg/gpg-agent.conf
default-cache-ttl 28800
max-cache-ttl 28800
@Partyschaum
Copy link

Maybe helpful for the less experienced GPG users (like myself):

Use gpg --armor --export <your-mail@address.here> | pbcopy to export your public key into your clipboard. Paste this into the appropriate textarea in the GPG Keys section of your GitHub settings page

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