Error: gpg failed to sign the data fatal

65    Asked by ChloeBurgess in QA Testing , Asked on Sep 27, 2024

I am trying to push/commit my code using Git. but I am facing an error:

gpg failed to sign the data

fatal: failed to write commit object


Background :

Previously it was working fine, but then I observed an error on Git, i am using a Mac and the Application is Git & GPG keychain. Please share if the same issue you have faced or maybe a related issue.


Answered by Daniel BAKER

I don’t know if it will work for your case or not but what steps I take generally I am sharing with you


By Trying below I will try to fetch why this is not working.

   $ echo "Hello" > test.txt
   $ gpg --sign --default-key test.txt

Error faced:

gpg: signing failed: No pinentry
gpg-agent[59045]: can't connect to the PIN entry module '/usr/local/bin/pinentry': IPC connect call failed
gpg-agent[59045]: failed to unprotect the secret key: No pinentry

From terminal I hit below cmd :

    cat ~/.gnupg/gpg-agent.conf
Check if below statement is present. Need to add if not present in gpg-agent.conf
pinentry-program /usr/local/MacGPG2/libexec/pinentry-mac.app/Contents/MacOS/pinentry-mac
Added pinentry path then run:
    $ gpgconf --kill gpg-agent
    $ gpg --sign --default-key test.txt

Output:

gpg: using as default secret key for signing



Your Answer

Interviews

Parent Categories