Run the following to install the gpg agent:
brew upgrade gnupg # This has a make step which takes a while
brew link --overwrite gnupg
brew install pinentry-mac
echo "pinentry-program /usr/local/bin/pinentry-mac" >> ~/.gnupg/gpg-agent.conf
killall gpg-agent
echo "test" | gpg --clearsign
Configure git to sign the messages:
git config --global gpg.program gpg # perhaps you had this already? On linux maybe gpg2
git config --global commit.gpgsign true # if you want to sign every commit
gpg --list-secret-keys --keyid-format LONG
git config --global user.signingkey ABCDEF01 (where ABCDEF01 is the fingerprint of the key to use)
Use the following command to show signed commits in git log
git log --show-signature