VSCode远程SSH无法连接

时间:2019-12-12 16:56:18

标签: ssh visual-studio-code

我正在尝试使用Remote-SSH扩展从Windows 10开发计算机上的Linux服务器上编辑文件。通常,我使用VNC登录服务器并在本地编辑文件,或者使用WinSCP将文件拉到我的开发机器上,并在完成后将它们复制回去。远程SSH扩展似乎可以解决这种效率低下的问题。

我可以使用Putty或Git Bash进行SSH正常运行,但是远程SSH无法连接。错误消息中有一些提示,但是我不确定如何解释它们。

这是我的SSH配置文件(已编辑)和我收到的错误(已编辑):

配置:

Host xxx.yy.gov
  HostName xxx.yy.gov
  User myusername

错误消息:

[08:44:36.981] remote-ssh@0.47.2
[08:44:36.981] win32 x64
[08:44:36.983] SSH Resolver called for "ssh-remote+xxx.yy.gov", attempt 1
[08:44:36.983] SSH Resolver called for host: xxx.yy.gov
[08:44:36.983] Setting up SSH remote "xxx.yy.gov"
[08:44:37.030] Using commit id "[some-string-of-numbers]" and quality "stable" for server
[08:44:37.033] Testing ssh with ssh -V
[08:44:37.101] ssh exited with code: 0
[08:44:37.101] Got stderr from ssh: OpenSSH_for_Windows_7.6p1, LibreSSL 2.6.4
[08:44:37.105] Running script with connection command: ssh -T -D 52772 xxx.yy.gov bash
[08:44:37.107] Install and start server if needed
[08:44:37.111] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[08:44:37.264] > 
[08:44:37.264] Got some output, clearing connection timeout
[08:44:37.611] > myusername@xxx.yy.gov's password:
[08:44:37.612] Showing password prompt
[08:44:44.709] Got password response
[08:44:44.709] "install" wrote data to terminal: "**************"
[08:44:44.730] > 
> 
[08:44:45.102] > bash: bash: command not found
> 
[08:44:45.476] "install" terminal command done
[08:44:45.476] Install terminal quit with output: bash: bash: command not found
[08:44:45.476] Received install output: bash: bash: command not found
[08:44:45.477] Stopped parsing output early. Remaining text: bash: bash: command not found
[08:44:45.477] Failed to parse remote port from server output
[08:44:45.477] Resolver error: 
[08:44:45.480] TELEMETRY: {"eventName":"resolver","properties":{"outcome":"failure","reason":"UnparsableOutput",
"askedPw":"1","askedPassphrase":"0","asked2fa":"0","askedHostKey":"0","gotUnrecognizedPrompt":"0",
"remoteInConfigFile":"1"},"measures":{"resolveAttempts":1,"retries":1}}
[08:44:45.482] ------

VSCode Remote-SSH error

1 个答案:

答案 0 :(得分:0)

您可以尝试三种方法。我知道这个问题很烦人。

  1. 检查您的 vscode 是本地窗口还是远程窗口。然后,检查 远程 ssh 设置。 (确保本地服务器下载是自动&&使用 本地服务器被标记。)
  2. 远程 SSH:路径。您可以切换到本地 ssh 或 git/ssh
  3. 尝试更新或恢复remote-ssh。(我发现0.50版本可以稳定连接到服务器主机。这个非常有用。