microsoft / vscode-remote-release

Visual Studio Code Remote Development: Open any folder in WSL, in a Docker container, or on a remote machine using SSH and take advantage of VS Code's full feature set.
https://aka.ms/vscode-remote
Other
3.68k stars 296 forks source link

Cloning a repository in a volume doesn't respect .ssh/config settings #10366

Open Clockwork-Muse opened 1 month ago

Clockwork-Muse commented 1 month ago

Version: 1.94.0 (user setup) Commit: d78a74bcdfad14d5d3b1b782f87255d802b57511 Date: 2024-10-02T13:08:12.626Z Electron: 30.5.1 ElectronBuildId: 10262041 Chromium: 124.0.6367.243 Node.js: 20.16.0 V8: 12.4.254.20-electron.0 OS: Windows_NT x64 10.0.22631 Remote Extension/Connection Type: WSL/Docker Desktop

(And more generally doesn't seem to pass along the ssh config to devcontainers)

I've recently gained access to my company's GitHub cloud account. Unfortunately, because my company uses managed accounts for this, it means I need to set up separate ssh keys for using git with ssh keys. I created the keys in Windows, added them to the agent on the Windows side, and then added the following entry to .ssh/config:

# Alternatively, a non-domain alias
Host company.github.com
  HostName github.com
  User company_username
  IdentityFile .ssh/id_ed25519_company

On Windows, this correctly allows me to test the connection via ssh -t git@company.github.com and clone as normal, however this doesn't work inside recovery devcontainers, nor does it allow me to clone with the alias set from the command menu.

Steps to Reproduce:

  1. Configure .ssh/config as shown
  2. Attempt to clone a repository via Ctrl+Shift+P then selecting Dev Containers: Clone Repository in Container Volume and entering a modified url (eg, git@company.github.com:microsoft/vscode-remote-release.git)

Does this issue occur when you try this locally?: Yes Does this issue occur when you try this locally and all extensions are disabled?: Yes

Side note: Even though the clone fails, for some unknown reason the user reported for the default ssh -T git@github.com from inside the container is the company user, not my personal user - which is what is reported from Windows. I can also clone with the unmodified URL from the command line from inside the recovery container (so setting up an empty devcontainer and then cloning into it would work, although that's somewhat more involved)