Git commit signing on Windows inconstently fails on first try

64 views Asked by At

I've had this problem for as long as I can remember signing commits on Windows, even across devices: I'm using gpg4win, and whenever I sign the first commit after restarting the computer (by just committing code via git, and it having signing enabled with a correct key set), it appears the gpg-agent needs to start first, so it takes ~10 seconds before the pinentry-qt window for entering the passphrase opens. Every third time this first attempt happens, however, after a long wait of about 30 seconds, it just fails with

gpg: can't connect to the gpg-agent: IPC connect call failed
gpg: keydb_search failed: No agent running

Whether it's from the terminal, git bash, or IntelliJ's dialogs. Just repeating the same commit command again will have it open up again though, after the usual delay.

I guess my question is, how do I either have the gpg (signing?) agent be available directly on startup to avoid this and the delay, or at least fix it randomly being unable to start the agent on the first try

1

There are 1 answers

0
kennytv On BEST ANSWER

Adding gpgconf --launch gpg-agent to the Windows task scheduler on login seems to have fixed that. I'm still confused I haven't found a more streamlined/automated solution still, but hey