Yubikey unreliability


I am trying to use a Yubikey to authenticate to a Bitbucket Server (Stash) using Sourctree with GPG4Win acting as pageant. I have it mostly working, but sometimes it appears to get hung. Usually if it hangs, I am able to fix the issue by running the following batch file:

taskkill /im pageant.exe
gpg-connect-agent killagent /bye
gpg-connect-agent /bye

The problem is that even after running the batch file, sometimes it remains hung. I have tried many things to resolve this including killing gpg-agent, killing scdaemon, unplugging/replugging the Yubikey, trying gpg --card-edit, etc. The only thing that I have found 100% reliable is to completely reboot the computer.

The symptom of hung that I am seeing is that when I try to fetch/push/pull using SourceTree, it doesn’t popup pinentry. In addition, when it is hung gpg --card-edit says:
gpg: selecting openpgp failed: Card error
gpg: OpenPGP card not available: Card error

Is there anything I can look at to figure out what is getting hung?

Thanks for any help!

Hi Paul,
you try to enable more diagnostic message to see what is going on.

You’ll get some pointers from http://wiki.gnupg.org/TroubleShooting

Also consider asking on the mailinglist, once you have more logs
and give more speficic version numbers.


Thanks for the advice. I turned on log for GPG Agent and the Smartcard Daemon. If I can’t figure it out from that I’ll post to the mailing list.