51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

VS Code SSH保持连接不稳定,但我可以正常使用SSH。

英文:

VS Code SSH keeps dropping connections, but I can SSH just fine

问题 {#heading}

我在远程机器和本地机器上设置了SSH,目的是使用VS Code SSH。我可以使用命令行中的ssh连接到我的远程机器,但是VS Code在成功连接后不断断开连接,显示类似ssh child died, shutting down的消息。

为什么我可以通过命令行SSH连接,但不能在VS Code中连接?我该如何修复这个问题?

背景 {#heading-1}

我该如何修复这个问题,以便在VS Code中连接? 英文:

I set up SSH on a remote machine & a local machine, with the intent of using VS Code SSH. I can connect to my remote with ssh in the command line, but VS Code keeps dropping connections after successfully connecting with something like ssh child died, shutting down.

Why can I connect via CLI SSH, but not VS Code? How do I fix this?

Background {#background}

How do I fix this, so I can connect in VS Code?

答案1 {#1}

得分: 1

解决方法

禁用Remote.SSH: 使用本地服务器 (将remote.SSH.useLocalServer设置为false):

VS Code SSH保持连接不稳定,但我可以正常使用SSH。

根据此GitHub问题中的Rob Lourens的说法:

> 您遇到了一些Windows SSH服务器版本的错误 :/

更多信息

来自该问题的相关日志(在修复问题后,我无法获取自己的日志):

[16:11:07.635] stderr> 已通过身份验证到 127.0.0.1 ([127.0.0.1]:22)。
[16:11:10.183] stderr> client_loop: 发送断开连接:连接被对等方重置
[16:11:10.244] > local-server-1> ssh 子进程已终止,正在关闭
[16:11:10.368] 本地服务器退出:0

// ...

client_loop: 发送断开连接:连接被对等方重置
local-server-1> ssh 子进程已终止,正在关闭

[16:11:10.370] 无法从服务器输出中解析远程端口
[16:11:10.374] 解析器错误:错误:
    在 Function.Create (c:\Users\alros\.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.79.2022040715\out\extension.js:1:585789)
    在 Object.t.handleInstallOutput (c:\Users\alros\.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.79.2022040715\out\extension.js:1:584441)
    在 Object.e [作为 tryInstallWithLocalServer] (c:\Users\alros\.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.79.2022040715\out\extension.js:1:624908)
    在 processTicksAndRejections (node:internal/process/task_queues:96:5)
    在 async c:\Users\alros\.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.79.2022040715\out\extension.js:1:643945
    在 async Object.t.withShowDetailsEvent (c:\Users\alros\.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.79.2022040715\out\extension.js:1:647692)
    在 async c:\Users\alros\.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.79.2022040715\out\extension.js:1:623380
    在 async b (c:\Users\alros\.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.79.2022040715\out\extension.js:1:619886)
    在 async Object.t.resolveWithLocalServer (c:\Users\alros\.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.79.2022040715\out\extension.js:1:622995)
    在 async Object.t.resolve (c:\Users\alros\.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.79.2022040715\out\extension.js:1:645302)
    在 async c:\Users\alros\.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.79.2022040715\out\extension.js:1:722235
[16:11:10.380] ------

英文:

Solution {#solution}

Disable Remote.SSH: Use Local Server (set remote.SSH.useLocalServer to false):

VS Code SSH保持连接不稳定,但我可以正常使用SSH。

Per Rob Lourens in this GitHub issue:

> You are hitting a bug with some versions of the windows ssh server :/

More information {#more-information}

Relevant logs from the issue (I couldn't get my own logs after fixing the issue):

[16:11:07.635] stderr> Authenticated to 127.0.0.1 ([127.0.0.1]:22).
[16:11:10.183] stderr> client_loop: send disconnect: Connection reset by peer
[16:11:10.244] > local-server-1> ssh child died, shutting down
[16:11:10.368] Local server exit: 0

// ...


client_loop: send disconnect: Connection reset by peer
local-server-1\> ssh child died, shutting down

`[16:11:10.370] Failed to parse remote port from server output
[16:11:10.374] Resolver error: Error:
at Function.Create (c:\Users\alros.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.79.2022040715\out\extension.js:1:585789)
at Object.t.handleInstallOutput (c:\Users\alros.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.79.2022040715\out\extension.js:1:584441)
at Object.e [as tryInstallWithLocalServer] (c:\Users\alros.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.79.2022040715\out\extension.js:1:624908)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async c:\Users\alros.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.79.2022040715\out\extension.js:1:643945
at async Object.t.withShowDetailsEvent (c:\Users\alros.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.79.2022040715\out\extension.js:1:647692)
at async c:\Users\alros.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.79.2022040715\out\extension.js:1:623380
at async b (c:\Users\alros.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.79.2022040715\out\extension.js:1:619886)
at async Object.t.resolveWithLocalServer (c:\Users\alros.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.79.2022040715\out\extension.js:1:622995)
at async Object.t.resolve (c:\Users\alros.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.79.2022040715\out\extension.js:1:645302)
at async c:\Users\alros.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.79.2022040715\out\extension.js:1:722235
[16:11:10.380] ------
`


赞(1)
未经允许不得转载:工具盒子 » VS Code SSH保持连接不稳定,但我可以正常使用SSH。