欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

ftp无法与服务器建立连接_解决VS Code Remote Development插件无法建立SSH连接的问题...

程序员文章站 2024-02-15 19:31:04
...

ftp无法与服务器建立连接_解决VS Code Remote Development插件无法建立SSH连接的问题...

最近在一次Windows更新之后,使用VS Code Remote Development插件再也无法连接上我的远程服务器了。由于这个插件实在太符合我的需求,无法连接的问题给我带来了很多不便。

在开启了VS Code的终端日志后发现,发现了如下日志:

[email protected]
win32 x64
SSH Resolver called for "ssh-remote", >attempt 1
SSH Resolver called for host: Server
Setting up SSH remote "Server"
Using commit id "" and quality "stable" for server
Testing ssh with ssh -V
ssh exited with code: 0
Got stderr from ssh: OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
Running script with connection command: "ssh" -o ClearAllForwardings=true "Server" bash
Install and start server if needed

 ssh: Could not resolve hostname server: 262273326252265300325342321371265304326367273372241243

似乎是ssh命令处理中文字符有些问题,并且把配置文件Server当作了一个域名。系统语言切换到英语之后这些打印就很正常了,但是配置文件依旧不能正确读取。

联想到之前使用是很正常的,怀疑是不是系统里的ssh命令被替换过了,全局搜索了一下,果不其然,Windows自己安装了一套OpenSSH Client, 使用这套程序所有的中文打印都是乱码。

解决方法如下:

在 开始-》设置-》应用-》可选功能 中删除OpenSSH客户端,重启。把Git目录下包含ssh命令的目录添加至Path中。

根据知友 @吴中骊 提示,可以通过设置REMOTE.SSH:Path指定ssh路径,不需要删除Windows的OpenSSH。