Strange behavior in both Git Bash and IDEs
delucca opened this issue · 1 comments
Describe the bug
For some reason I'm not being able to use my SSH and GPG clients in both Git Bash and my IDE (Jetbrains Idea).
I'm using wsl2-ssh-pageant
as a way to fetch my GPG and SSH credentials from my Yubikey. When I use it from Linux, it works as expected. First, I start my gpg-agent with gpgconf --launch gpg-agent
, them I reboot my WSL and, afterwards, I can run both gpg --card-status
and ssh-add -L
inside my Linux machine and it fetches my credentials.
The problem is on the Windows side. On a new Powershell I can run gpg --card-status
and see the expected output, but running ssh-add -L
leads to:
PS C:\Users\accou> ssh-add -L
Error connecting to agent: No such file or directory
When it should display my ssh-keys from my Yubikey (as it does in Linux):
~
❯ ssh-add -L
ecdsa-sha2-nistp384 AAAAE2VjZHNhLXNoYTItbmlzdHAzODQAAAAIbmlzdHAzODQAAABhBAkNoM9kXjOtO1elu47lOWTemQINo4C1585yWK8xvuvbkkrCnxCdEpg7kOyYGG5G1+mTUzHSCg5hvK11wXgQHTvAOxgNw1ZcDrcdwnXwNVKs1quek9zLqNyi9ySoem4R1w== cardno:13 380 995
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINzpr94SDBXbnKE5EHMAwAhSkhRZK2Zordf3BoINFxww cardno:13 380 995
The problem is worse when I open an Bash terminal (from Git) inside Windows. My gpg --card-status
leads to:
accou@bud-0001 MINGW64 ~
$ gpg --card-status
gpg: selecting card failed: No such device
gpg: OpenPGP card not available: No such device
(after a long delay)
And the ssh-add -L
has the same result as it does in Powershell.
That should not be a problem (since it is working in Linux), but I would like to fetch/push from my git repositories (configured to use SSH) directly in my IDE, but I can't. Since my IDE is running in Windows, it can sign my commits (problably because Powershell can see my gpg key) but I can't use my SSH key.
Expected behavior
I would like to use my GPG and SSH keys on both sides (Linux and Windows)
This is not an issue of wsl2-ssh-pageant. As it does not deal with the windows side. This is something which needs to be dealt with by the user.
The ssh client internally in windows does not support putty like agents (gpg with enable putty-agent) enabled. Therefore your ssh-add -L
fails. There exists an third party tool which should enable this. Have a look into: https://github.com/benpye/wsl-ssh-pageant#how-to-use-with-windows-10-native-openssh-client
As why gpg --card-status
does not work I'm not sure. I would suggest looking if the gpg version within the git shell is different to the other one or environment variables are messes around with.