-
Read and understand https://help.github.com/articles/signing-commits-using-gpg/
-
Configure Git to sign all the commits, see https://github.com/mlafeldt/dotfiles/commit/f4554f0a122145509da5cdf4180037b3bc13b0ab
-
Install gpg-agent (we don't want to enter a password for each commit)
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
Maybe helpful for the less experienced GPG users (like myself):
Use
gpg --armor --export <[email protected]> | 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