Skip to main content

Resolving GPG Fail to Sign Error

If you get...

git commit -m "add yarn.lock"
error: gpg failed to sign the data
fatal: failed to write commit object

Then...

brew upgrade gnupg
brew link --overwrite gnupg
brew install pinentry-mac
echo "test" | gpg --clearsign
git config --global gpg.program gpg
git config --global commit.gpgsign true
git log --show-signature -1

Make sure you didn't delete ~.gnupg.

Reference​