0、引言
导致VScode连接失败的原因有很多。该方法仅针对超时引起的报错。
1、报错内容:
[18:01:33.071] Running script with connection command: "C:\Windows\System32\OpenSSH\ssh.exe" -T -D 53443 "docker_sys" bash
[18:01:33.072] Terminal shell path: C:\Windows\System32\cmd.exe
[18:01:50.082] Resolver error: Error: Connecting with SSH timed out
at m.Timeout (c:\Users\23375\.vscode\extensions\ms-vscode-remote.remote-ssh-0.113.1\out\extension.js:2:501356)
at Timeout._onTimeout (c:\Users\23375\.vscode\extensions\ms-vscode-remote.remote-ssh-0.113.1\out\extension.js:2:621986)
at listOnTimeout (node:internal/timers:573:17)
at process.processTimers (node:internal/timers:514:7)
[18:01:50.086] ------
2、原因:
路由器比较老,网速过慢导致连接超时
3、解决方法:
延长等待连接时间。
将默认的15s调大,例如如改为60s,具体时间因网速而异。