无法将 VS Code 连接到 Linux 机器进行远程开发

Jon*_*nte 21 ssh visual-studio-code vscode-remote

我在 VS Code 上收到此错误,但不知道为什么会失败

[15:14:59.543] Log Level: 2
[15:14:59.555] remote-ssh@0.51.0
[15:14:59.555] win32 x64
[15:14:59.560] SSH Resolver called for "ssh-remote+xx.xx.xx.xx", attempt 1
[15:14:59.561] SSH Resolver called for host: xx.xx.xx.xx
[15:14:59.561] Setting up SSH remote "xx.xx.xx.xx"
[15:14:59.621] Using commit id "0ba0ca52957102ca3527cf479571617f0de6ed50" and quality "stable" for server
[15:14:59.624] Install and start server if needed
[15:15:01.964] getPlatformForHost was canceled
[15:15:01.965] Resolver error: Connecting was canceled
[15:15:01.973] ------
Run Code Online (Sandbox Code Playgroud)

小智 21

如下添加一个键settings.json。请记住将 替换$remote_server_name为您的。

    "remote.SSH.remotePlatform": {
        "$remote_server_name": "linux"
    }

Run Code Online (Sandbox Code Playgroud)

菜单:文件->首选项->设置

或点击图标打开settings.json

  • 谢谢老板!当使用非管理员权限打开 vscode 时,我无法编辑 settings.json。但是,我尝试使用“以管理员身份运行”,它起作用了,它询问我“选择远程主机的平台”。选项是“Linux/Windows/Mac”。选择后,成功了! (2认同)

imp*_*ato 8

在您输入 user@host type/select Linux/Windows/etc 的对话框中。取决于您使用的是什么,然后键入/选择继续,然后键入远程会话的密码。

  • 谢谢。第一次并不明显,在新窗口的顶部,您选择了操作系统目标,然后在底部窗口中输入密码 (3认同)