error: gpg failed to sign the data fatal: failed to write commit object
It took me more than two hours to narrow down the cause of the error:
These does not work too:
MacBook-Air:~ jack$ gpg2 --list-secret-keys gpg: can't connect to the agent: IPC connect call failed MacBook-Air:~ jack$ gpg-agent --daemon gpg-agent[1499]: /Users/jack/.gnupg/gpg-agent.conf:2: invalid option
Error is caused by wrong configuration in gpg-agent.conf:
$ cat ~/.gnupg/gpg-agent.conf
For some reasons the second line was added to the configuration:
pinentry-program /usr/local/bin/pinentry-mac /usr/local/bin/pinentry-mac
That should just configured with this:
pinentry-program /usr/local/bin/pinentry-mac
After correcting the configuration, gpg-agent is now working:
MacBook-Air:~ jack$ gpg-agent -v --daemon gpg-agent[2012]: listening on socket '/Users/jack/.gnupg/S.gpg-agent' gpg-agent[2012]: listening on socket '/Users/jack/.gnupg/S.gpg-agent.extra' gpg-agent[2012]: listening on socket '/Users/jack/.gnupg/S.gpg-agent.browser' gpg-agent[2012]: listening on socket '/Users/jack/.gnupg/S.gpg-agent.ssh' gpg-agent[2013]: gpg-agent (GnuPG) 2.1.21 started
And so is gpg2:
MacBook-Air:~ jack$ gpg2 --list-secret-keys gpg-agent[2013]: handler 0x70000e9d4000 for fd 7 started /Users/jack/.gnupg/pubring.gpg ------------------------------ sec rsa2048 2016-12-12 [SC]
With that, committing with gpg signing shall work, must configure gpg to use gpg2 if it is not yet configured to gpg2:
MacBook-Air:~ jack$ git config --global gpg.program gpg2
Happy Coding!
No comments:
Post a Comment