FIX - gpg failed to sign the data fatal: failed to write commit object

Posted on Aug 14, 2022

For MacOS | Mojave | High Sierra | BigSur | Monterey

Step 1 - Upgrade current gpg

brew upgrade gnupg

Step 2 - Install pinentry-mac

brew install pinentry-mac

Step 3 - Update gpg-agent.conf

echo "pinentry-program /usr/local/bin/pinentry-mac" >> ~/.gnupg/gpg-agent.conf

Step 4 - Restart gpg-agent

killall gpg-agent && gpg-agent --daemon

Step 5 - Configure git to use GPG

git config --global gpg.program gpg
git config --global commit.gpgsign true