Skip to content

Instantly share code, notes, and snippets.

@Peredery
Last active May 19, 2024 08:36
Show Gist options
  • Save Peredery/38d0538dd34381bbd9d13414269a1f27 to your computer and use it in GitHub Desktop.
Save Peredery/38d0538dd34381bbd9d13414269a1f27 to your computer and use it in GitHub Desktop.
FIX - gpg failed to sign the data fatal: failed to write commit object

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

!!! For M1/M2 apple silicon see this comment:

https://gist.github.com/Peredery/38d0538dd34381bbd9d13414269a1f27?permalink_comment_id=4559612#gistcomment-4559612

For MacOS | Mojave | High Sierra

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
@foxmean
Copy link

foxmean commented May 16, 2024

Thanks! I use MacBookAir M1 Machine and the modified version of this guide from @shaunsim15 works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment