You have installed GPG, then tried to perform a git commit and suddenly you see this error message after it 😰
error: gpg failed to sign the data
fatal: failed to write commit object
Understand the error (important to solve it later!)
| For troubleshooting, two things to first try: | |
| run `git config --global gpg.program gpg2`, to make sure git uses gpg2 and not gpg | |
| run `echo "test" | gpg2 --clearsign`, to make sure gpg2 itself is working | |
| If that all looks all right, one next thing to try: | |
| run `brew install pinentry` to ensure you have a good tool installed for passphrase entry | |
| If after that install and you re-try git commit and still get the "failed to sign the data" error: | |
| run `gpgconf --kill gpg-agent` to kill any running agent that might be hung |