Git fails to sign a commit, with _Windows_ VSCode Remote SSH, when GnuPG on the local+remote computers are configured to use the local GPG agent/keys.
Version: 1.36.1 (system setup)
Commit: 2213894ea0415ee8c85c5eea0d0ff81ecc191529
Date: 2019-07-08T22:59:35.033Z
Electron: 4.2.5
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Windows_NT x64 10.0.18362
Remote SSH Extension: 0.44.2
Remote Development pack: 0.15.0
In WSL Ubuntu 18.04...
gpg.program=gpg, user.signingkey=xxxxxx, and commit.gpgsign=trueNow on this remote Ubuntu 18.04 server...
dummy filegit log --show-signature and notice the successful gpg signature. 🙂 This demonstrates that the remote git+ssh+gpg is successfully going over the ssh tunnel and using the local gpg agent/keys.Now on your Windows computer
dummy fileThe commit fails and VSCode shows a modal error dialog box Git: gpg failed to sign the data
In the Output tab for Remote - SSH is the following of interest. Notice the last line with error
SSH Resolver called for host: home-nas
Setting up SSH remote "home-nas"
Using commit id "2213894ea0415ee8c85c5eea0d0ff81ecc191529" and quality "stable" for server
Testing ssh with ssh -V
ssh exited with code: 0
Got stderr from ssh: OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
Running script with connection command: "ssh" -o ClearAllForwardings=true "home-nas" bash
...
> connect to /home/dale/.gnupg/S.gpg-agent.extra port -2 failed: No such file or d
> irectory
Successful commit
I believe part of the problem is due to _Windows_ VSCode using a Win32 SSH program yet my entire GPG and SSH configuration is in WSL. In WSL I have all the SSH config settings and entire GPG environment/agent.
This topic of sockets and forwarding are likely related to the following two: https://github.com/microsoft/vscode-remote-release/issues/16 , https://github.com/microsoft/vscode-remote-release/issues/72
Potential workaround in the topic https://github.com/microsoft/vscode-remote-release/issues/937
This is my ~/.ssh/config in WSL
Host myremoteserver
User dale
Hostname myremoteserver
IdentityFile ~/.ssh/id2_rsa
RemoteForward /run/user/1000/gnupg/S.gpg-agent /home/dale/.gnupg/S.gpg-agent.extra
Given the error in the Remote - SSH log above, this suggests to me that the Windows SSH client is:
/home/dale/.gnupg/S.gpg-agent.extra@diablodale Is this equivalent? #72
In my notes area, 72 is one of the three related issues. However, not duplicates. 72 is focused on only docker containers and already has a workaround.
I see, sorry ... my bad ... completely missed your notes area 🤦♂️
You are right that this is about the WSL side and windows side. I have https://github.com/microsoft/vscode-remote-release/issues/937 for that.
I don't see any reason why this wouldn't work with #937, so I'll close it as a duplicate for now. Have you tried verifying that by just SSHing from a WSL terminal?
Also I see you found the SSH agent forwarding issue, which sounds relevant, but I think it isn't because that is really about setting the SSH_AUTH_SOCK environment variable so it can find the forwarded agent socket. However it sounds like in this case you always use the same remote socket path and there is no environment variable that needs to be fixed in the remote environment.
Hello. As I read what you wrote, I think your collapsing together two things:
Making the former new feature might obscure the latter. So this issue becomes a test case (not a dup) that testers needs to add to the test case list.
Alternately, thelatter bug could be fixed which requires code changes to recognize a WSL path+config was given and then to either: a) abort with meaningful error, or b) to the transformations.
I don't think it's possible for vscode to do anything about the second issue on it's own. Trying to map the wsl path to a windows path will just lead to pain, and I also don't think vscode should try to validate an ssh config any further than what openssh itself does. But I will leave this issue open to make sure it is considered carefully along with #937.
Facing same issue via SSH with Linux to Linux.
For me, this solves the problem
export GPG_TTY=$(tty)
For me, this solves the problem
export GPG_TTY=$(tty)
I tried this, adding it to the remote machine's .bashrc but I'm still getting the error. Any other ideas?
Most helpful comment
For me, this solves the problem
export GPG_TTY=$(tty)https://unix.stackexchange.com/questions/257061/gentoo-linux-gpg-encrypts-properly-a-file-passed-through-parameter-but-throws-i/257065#257065