Signing Git Commits without Entering Password Using `gpg-agent` and `pinentry-mac` on OS X

Install required packages via Homebrew:

$ brew install gpg gpg-agent pinentry-mac

Edit and add the following lines in ~/.gnupg/gpg-agent.conf:

pinentry-program /usr/local/bin/pinentry-mac

Edit and enable use-agent in ~/.gnupg/gpg.conf:

use-agent

Then add the following line to your shell profile:

eval $(gpg-agent --daemon --sh)