windowsgitgit-bashgnupggpg-agent

IPC Error on GPG Agent with Git on Windows


I would like to use GPG without Gpg4win installed on Windows because Git for Windows includes the binary for GPG we well, so I would like to use it instead of installing an extra application.

However, when I setup the GPG (e.g adding Path etc), I have encountered the following error:

C:\Users\me> gpgconf --launch gpg-agent
gpgconf: error running '/usr/bin/gpg-connect-agent': exit status 1
gpgconf: error running '/usr/bin/gpg-connect-agent NOP': General error

And with gpg-connect-agent:

C:\Users\me> gpg-connect-agent /bye
gpg-connect-agent: no running gpg-agent - starting '/usr/bin/gpg-agent'
gpg-connect-agent: waiting for the agent to come up ... (5s)
gpg-connect-agent: waiting for the agent to come up ... (4s)
gpg-connect-agent: waiting for the agent to come up ... (3s)
gpg-connect-agent: waiting for the agent to come up ... (2s)
gpg-connect-agent: waiting for the agent to come up ... (1s)
gpg-connect-agent: can't connect to the agent: IPC connect call failed
gpg-connect-agent: error sending standard options: No agent running

I need the agent to be running in order to sign the git commits, so I am not sure what is happening.

Before this error happens, I was using Gpg4win, which has no errors at all (to make sure it is not a versioning issue, I have removed everything in %userprofile%/.gnupg)

System Info:

Any help would be appreciated. Thanks


Solution

  • I managed to figure it out.

    This is because the gpg in git for windows uses MINGW64 for the environment. And because I manually set the GNUPGHOME environment variable to a Windows path: C:/users/me/.gnupg, it will not work.

    (I never use the included MINGW64 git bash, I only use cmd and add those exe, like git, gpg into PATH)

    So, if you have manually set the GNUPGHOME env variable, you need to change to a MINGW64 path.

    So in my case, C:/users/me/.gnupg -> /c/users/me/.gnupg

    I am not sure about --homedir though.