git extension in vscode in WSL window via SSH not working

Viewed 916

I'm working with a bitbucket repository in a vscode window in WSL per SSH. cloning, pulling, pushing etc. works fine, as long as I'm typing the git commands in the vscode bash terminal. once per terminal session I'm asked for my SSH passphrase.

but: every git action, which I'm trying to start with the "Source Control" extension inside vscode, doesn't work.

example: button "Clone Repository" apparently starts cloning, but doesn't copy any repo files (although it creates the repo folder and the .git subfolder).

the git output in vscode shows the executed command, but nothing is happening effectively:
git clone git@bitbucket.org:<repoURL> <repoFolder> --progress

meanwhile the vscode tooltip "Cloning git repository" remains until forever. it never asked for my SSH passphrase, but doesn't throw any error.

I've tried to add my ssh-keys beforehand, but there's no change afterwards.

There's no such problem with the "Source Control" extension when I'm working in windows.

UPDATE 2021-10-29 reproducable behavior:

  • git operations via the vsCode GUI ("Source Control") are working if no passphrase is set for the ssh key
  • if a passphrase is set and the keyfile has the default name (id_rsa), it will behave as mentioned above
  • if a passphrase is set and the keyfile has not the default name, it shows the "permission denied (publickey)" error.
1 Answers

simple solution:

I configured my .bashrc in WSL2 with eval ``keychain --eval --agents ssh id_rsa``

now vsCode Source Control works with passphrase-protected ssh keys. key files can be named arbitrarily.

Related