Using GPGAgent as SSHAgent on Windows with cygwin/mingw

Felix Winterhalter felix at
Sat Sep 24 14:10:27 CEST 2016

So I am currently trying to get gpg-agent to play nice with ssh on
Windows. I'm running gpg version 2.1.15.

Using Linux I was able to get everything to run the way I want by adding

enable-ssh-support to the agent config

and setting the environment variable
SSH_AUTH_SOCK to the gpg agents ssh socket.

However on Windows I now get the error:

 ssh-add -L
Error connecting to agent: Bad file descriptor

Same for simple ssh during the public key lookup stage.

I can read the socket file using cat or less however and I get:


which seems to me to be a process ID + binary data. So the socket
appears to be there and it is recreated when I restart gpg-agent.

So the question is whether this is actually a gpg related bug or has
something to do with how ssh from cygwin works.

I do get the same error using ssh/ssh-add from MinGW though.

If anyone has any idea how to resolve this I'd be glad for some help.

However please don't suggest to simply use putty, I prefer to have a
shared configuration across my Linux and Windows boxes and I do use the
command line ssh utilities a lot for different things on Windows too.

Best regards,

More information about the Gnupg-users mailing list