On the latest version of Gpg4win, attempting to sign a git commit with my default GPG key results in the shell hanging for around 30 seconds (or up to a minute) until the following error is shown:
> git commit error: gpg failed to sign the data: gpg: can't connect to the keyboxd: IPC connect call failed? gpg: error opening key DB: No Keybox daemon running? gpg: skipped "MYKEYPUBID": Input/output error? [GNUPG:] INV_SGNR 0 MYKEYPUBID? [GNUPG:] FAILURE sign 33587249? gpg: signing failed: Input/output error? fatal: failed to write commit object
On my laptop, I can sometimes mitigate this by opening Kleopatra and then immediately closing it, which causes the pinentry screen to appear. However, on my desktop, this usually does not work and the first sign will almost always fail.
From the second sign onward, the pinentry screen will properly show up and I will be able to sign my commit with GPG. Once I have successfully used my GPG key, subsequent invocations will *always* work until I restart my computer. (By subsequent invocations, it includes instances where GPG still allows signing without re-prompting for my password and when the pinentry timeout has been reached and pinentry shows up to prompt me for the password again. Both continue to work until the computer is restarted.)
This affects two different Windows machines that I have. I'm using the following routine to get git to automatically sign my commits with my key.