Git GPG signing fails without a clear message

I've updated GPG on my mac using brew upgrade gpg after I saw my GPG was at version 2.2.5 and the newest was 2.2.10.

This has fixed the issue, for now. However, I still have no idea about what the cause of this problem was.


I stumbled upon this when encountering the same error and I was already on the latest version of gpg (2.2.17). For me, it turned out to be multiple things.

  1. Before committing I had to run $ export GPG_TTY=$(tty). This then prompted the passphrase prompt to appear.
  2. If I used a passphrase with a special character it didn't work (the prompt said I had a bad passphrase when trying to use), so I had to only use alphanumeric characters.

And if you're doing this to get verified commits on GitHub ensure the name and email address match what you have on GitHub.


If you have installed gpg using Homebrew, and are also using GPGTools, you need to uninstall Homebrew's gpg.

# Uninstall gpg in homebrew so that it uses the gpg in GPGTools instead
$ brew uninstall gpg

# You might need to do some extra cleanup afterward as well:
$ rm -r /opt/homebrew/etc/gnupg

# Restart the gpg-agent so that it uses the correct one:
$ gpgconf --kill gpg-agent

After that, git was able to sign my commits again.

Tags:

Git

Github

Gnupg