I installed GPG from brew.
brew install gpg
It is gnupg2-2.0.30_2.
When I commit, I do get a error message:
You need a passphrase to unlock the secret key for
user: "Max Mustermann (mycomment) <mm@test.de>"
2048-bit RSA key, ID 1111AAAA, created 2017-01-05
error: gpg failed to sign the data
fatal: failed to write commit object
I used the command:
gpg --list-secret-keys | grep ^sec
and it gives me back:
sec 2048R/1111AAAA 2017-01-05
Then I used this command:
git config --global user.signingkey 1111AAAA
commit gives me back the same error message.
How can I solve this problem?
If you’re not getting prompted at all for a passphrase (you don’t mention whether you are or not…), the solution may just be to also install a program to facilitate that. The most common is pinentry.
So installing that and trying again may get things working. But if not, another thing to do is make sure
git
it using/finding the right GPG program. These days you really should be usinggpg2
, so if you don’t already have that installed, do:And then, to tell
git
that’s the GPG program want to you, this:At that point, try your commit again and things may just work.
But if not, then try this:
…and then try again.
Note: Per some comments below, in order for this change to take effect, you apparently might need to reboot after making the change.