VSCode remote-ssh linux服务器时提示错误,一招解决.

今日VSCode在连接linux服务器时,报错错误:

1)问题现象:

连接remote-ssh服务器时,提示如下错误:

[09:50:27.277] "install" terminal command done [09:50:27.278] Install terminal quit with output: Host key verification failed. [09:50:27.278] Received install output: Host key verification failed. [09:50:27.278] Failed to parse remote port from server output [09:50:27.279] Resolver error: Error: at Function.Create (c:\Users\PC\.vscode\extensions\ms-vscode-remote.remote-ssh-0.66.0\out\extension.js:1:429193) at Object.t.handleInstallOutput (c:\Users\PC\.vscode\extensions\ms-vscode-remote.remote-ssh-0.66.0\out\extension.js:1:427836) at Object.t.tryInstall (c:\Users\PC\.vscode\extensions\ms-vscode-remote.remote-ssh-0.66.0\out\extension.js:1:521609) at processTicksAndRejections (internal/process/task_queues.js:93:5) at async c:\Users\PC\.vscode\extensions\ms-vscode-remote.remote-ssh-0.66.0\out\extension.js:1:485262 at async Object.t.withShowDetailsEvent (c:\Users\PC\.vscode\extensions\ms-vscode-remote.remote-ssh-0.66.0\out\extension.js:1:488612) at async Object.t.resolve (c:\Users\PC\.vscode\extensions\ms-vscode-remote.remote-ssh-0.66.0\out\extension.js:1:486341) at async c:\Users\PC\.vscode\extensions\ms-vscode-remote.remote-ssh-0.66.0\out\extension.js:1:559963 [09:50:27.284] ------

 

2)解决:

①通过chatGPT搜索得知,可能是KnowHost文件有问题,具体回答如下:

It seems like you are having trouble connecting to a remote server using the Remote-SSH extension in Visual Studio Code. The error message “Host key verification failed” suggests that there is a problem with the SSH host key verification process. This can happen if the remote server’s host key has changed, or if there is a problem with the known_hosts file on your local machine.

One possible solution to this issue is to remove the entry for the remote server from your known_hosts file. This file is typically located in the .ssh directory in your user’s home directory. You can open this file in a text editor and remove the line that corresponds to the remote server you are trying to connect to. After saving the changes, try connecting to the remote server again.

If this does not solve the issue, you may want to check the SSH configuration on both your local machine and the remote server to ensure that everything is set up correctly. You can also try using a different SSH client to connect to the remote server to see if the issue is specific to Visual Studio Code or if it is a more general problem with your SSH setup. I hope this helps! Let me know if you have any further questions. 😊

②打开knowhost文件

 

 清空以上内容,重新连接,即可正常进行连接.

3)原因

之前添加过相同IP的服务器,遗留的密钥串与新的服务器密钥串不一致,才会导致这样的问题.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值