SA
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
which pinentry-mac

Put the path into the gpg-agent.conf file. If there is no gpg-agent.conf file found in the ~/.gnupg/ directory, create one.

touch ~/.gnupg/gpg-agent.conf
echo "test" | gpg --clearsign
git config --global gpg.program gpg
git config --global commit.gpgsign true
git log --show-signature -1
gpgconf --kill gpg-agent

Make sure you didn't delete ~.gnupg.

Reference

Links to This Note