git signing error

sgandon's Avatar


13 Dec, 2022 05:53 PM

Which of our tools is giving you problems? gpg for signing commits

Attach a screenshot of the version info for all installed components (how to:

Describe your problem. Add as much detail as possible. I was using git commit signing with gpg suite fine and some a few days ago it started to show me this error

error: gpg failed to sign the data
fatal: failed to write commit object

It may have happened after I typed the wrong password on a mac key chain popup (not sure). But I have not more keychain pop up asking for my password.
One workaround is to run
gpg --status-fd=2 -bsau FC12B09A1Bxxxx
and then do Ctrl+D
I then have an ascii prompt to type my password and once entered I can run my commit command again and it signs it properly.

I have no real knowledge on the what is going on and the singing process.
Can someone help me get the automatic singing work please ?

What did you expect instead it worked

  1. Support Staff 1 Posted by Luke Le on 14 Dec, 2022 11:20 AM

    Luke Le's Avatar


    thank you for getting in touch.
    Could you try to have a look in macOS Keychain Access if you find an entry with label "GnuPG"? Under very special circumstance it is possible that an invalid passphrase is stored in macOS's keychain which might then result in the failure you are seeing.
    You can either modify the GnuPG entry to correct the passphrase, or remove it and should be asked for your passphrase when you try to sign the next time. (best make a backup first.)

    Hope that helps.

  2. 2 Posted by sgandon on 15 Dec, 2022 11:35 AM

    sgandon's Avatar

    Hello Luke Le,
    thank you for your answer but unfortunately I don't have any entry in my macOS key chain related to gpg or GnuPG.
    any other idea ?

  3. Support Staff 3 Posted by Luke Le on 15 Dec, 2022 01:48 PM

    Luke Le's Avatar

    Hmmm, i guess the problem is somehow related to gpg-agent. Is there any chance you have two different versions of gpg installed in parallel for example from homebrew or self-compiled?

    Also could you try running the following command:

    GIT_TRACE=1 git commit

    And post its output?

  4. 4 Posted by sgandon on 16 Dec, 2022 03:08 PM

    sgandon's Avatar

    grrrr, I just tried it again and probably because I updated my mac OS to Ventura, I got the pinentry popup to enter the passphrase.
    And now everything works fine.
    I should add to people facing the same problem is that using ssh key for signing github commits is way easier to setup than gpg.

    thank you for having tried to help me. The bottom line is to fix the issue install a new version of the OS :p

  5. Support Staff 5 Posted by Luke Le on 16 Dec, 2022 03:11 PM

    Luke Le's Avatar

    Haha, well I still think it‘s a good outcome.
    Maybe even a restart would have been enough. Strange for sure though.

  6. Steve closed this discussion on 16 Dec, 2022 04:58 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac