我可以在 Visual Studio 代码中从 WSL ssh 吗?

问题描述:

我在 windows 10 上使用 WSL 进行编程,最近发现可以通过 SSH 使用 VS code 编辑程序.

I am using WSL on windows 10 to program, and recently discovered that VS code can be used to edit programs through SSH.

但是,我通常通过 WSL SSH 连接到我大学的计算机,以便我可以访问这些系统上的文件并使用它们的 GPU.

However, I normally SSH into my university's computers through WSL so i can access the files on those systems and use their GPUs.

有什么方法可以使用 vscode SSH 到 WSL,然后 ssh 到我的大学系统,并从 vscode 中访问他们的资源和文件系统?

Is there any way to SSH into WSL using vscode, and then ssh into my universities systems, and have access to their resources and filesystems from with within vscode?

可以在windows下创建ssh.bat文件,内容如下:

You can create ssh.bat file under windows with the content:

C:\Windows\system32\wsl.exe ssh %*

然后设置 VS Code 设置remote.SSH.path";指向那个 bat 文件.
您将在 VS Code 中拥有与在 WSL 中相同的 ssh 配置和凭据.

And than set VS Code setting "remote.SSH.path" to point to that bat file.
You’ll have the same ssh configuration and credentials in VS Code as you have in WSL.