Run:
brew install gnupg pinentry-macgit config --global user.signingkey <key>git config --global commit.gpgsign truegit config --global gpg.program gpg
Then add the following line to ~/.gnupg/gpg-agent.conf:
pinentry-program /usr/local/bin/pinentry-mac
or, if using the new Homebrew location:
pinentry-program /opt/homebrew/bin/pinentry-mac
Thanks for this useful Gist!
I wanted to mention that the first step can be shortened:
There is no longer a need to specify
gnupg2because it has been renamed tognupg, as documented here.I also found that this step is not strictly necessary:
If
gpg.programis not specified, Git will usegpgby default, as documented here.