Vscode-remote-release: Git through SSH with passphrase-protected key when in WSL remote

Created on 16 Feb 2020  Â·  9Comments  Â·  Source: microsoft/vscode-remote-release


  • VSCode Version: 1.42.1
  • Local OS Version: Windows 10
  • Remote OS Version: Ubuntu
  • Remote Extension/Connection Type: WSL

I am trying to use git through SSH in a WSL remote. The SSH connection is protected with a key pair which is password-protected. I open WSL in terminal, I start an SSH agent there and add the key. Then I start VS Code with code . and try to use git But I can't do anything requiring SSH connection. No way to enter passphrase, no way to cancel - I have to restart VS Code.

The same happens when I start ssh-agent and add the key in the terminal window in the VS Code interface.

This is the same as #1774, which was closed as duplicate of microsoft/vscode#13680. But it is really not a duplicate, as the latter issue is said to be resolved with workaround explained here, but the former cannot.

VS Code does not "see" ssh-agent started in WSL.

wsl

Most helpful comment

I stumbled across this issue today as well. Not WSL but using the SSH remoting extension. Browsing through the issues on VS Code and the remoting extensions it seems that there are few integrations missing. No extra windows can be presented to the user when using remoting, hence gpg prompts don't show for code signing. I'm not sure which integration is missing, but when cloning code from the UI using SSH auth to the Git server on a remote machine (also using SSH for remoting) VS fails to prompt for the password on the key required for Git server auth.

All 9 comments

I stumbled across this issue today as well. Not WSL but using the SSH remoting extension. Browsing through the issues on VS Code and the remoting extensions it seems that there are few integrations missing. No extra windows can be presented to the user when using remoting, hence gpg prompts don't show for code signing. I'm not sure which integration is missing, but when cloning code from the UI using SSH auth to the Git server on a remote machine (also using SSH for remoting) VS fails to prompt for the password on the key required for Git server auth.

I've also run into this. It seems like it's a known issue. In the Remote Development Tips and Tricks doc under the Sharing Git credentials between Windows and WSL section it states:

Resolving hangs when doing a Git push or sync from WSL

If you clone a Git repository using SSH and your SSH key has a passphrase, VS Code's pull and sync features may hang when running remotely.

Either use an SSH key without a passphrase, clone using HTTPS, or run git push from the command line to work around the issue.

Setting up sharing of Git credentials between Windows and WSL and cloning using HTTPS is not ideal, but it's something.

Seen that. I hope it'll improve.

Am I the only one that's surprised to see this issue standing so long? I thought cloning (SSH), committing (gpg sign) and pushing is a core functionality. I'm not saying that not knowing TypeScript relieves me of being a candidate to implement this, but I hoped someone with more relevant skills would've picked this up long ago. Or did I miss the memo?

Same here - i've been happily using vscode with WSL and love it - except for this one annoyance. I keep falling into the trap of doing git actions from within vscode just to see the little progress bar going and going knowing that, in the background, git is asking for my passphrase ... i tried suggestions from here and here but still no luck :-

Well, what do you know - i think i got it working with the suggested changes to ~/.bashrc (or ~/.bash_profile) mentioned here ... give it a try!

@Verkurkie I was wondering, did you see the problem occur with Git operations triggered by VSCode (e.g from the SCM viewlet).
Or just with calling git from the integrated terminal?

@Verkurkie I was wondering, did you see the problem occur with Git operations triggered by VSCode (e.g from the SCM viewlet).
Or just with calling git from the integrated terminal?

@aeschli it was only when triggered by VSCode ... running git in the terminal was never a problem because it _does_ ask for the passphrase...

Not sure this helps but this might be the key issue here. I assume if this were possible to run, at least it would be a workaround that VSCode could properly implement later

╭─sausage@FATASS2 ~/Git/Fun/swizzin ‹formatting› 
╰─$ ssh-add ~/.ssh/id_rsa
Could not open a connection to your authentication agent.
Was this page helpful?
0 / 5 - 0 ratings

Related issues

gurdevrana picture gurdevrana  Â·  3Comments

grzegorz-silarski picture grzegorz-silarski  Â·  3Comments

kieferrm picture kieferrm  Â·  3Comments

nphmuller picture nphmuller  Â·  3Comments

JacksonKearl picture JacksonKearl  Â·  3Comments