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的服务器,遗留的密钥串与新的服务器密钥串不一致,才会导致这样的问题.

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Resolver error: Error: XHR failed 是一个常见的错误信息,通常在进行网络请求出现。它表示在发送 XMLHttpRequest(XHR)请求发生了错误。 XHR 是一种用于在浏览器和服务器之间进行数据交换的技术,通常用于异步加载数据或与服务器进行通信。当出现 Resolver error: Error: XHR failed 错误,可能有以下几个原因: 1. 网络连接问题:可能是由于网络连接不稳定或中断导致的。请检查您的网络连接是否正常,并尝试重新加载页面或重新发送请求。 2. 跨域请求问题:浏览器有一种安全机制,称为同源策略,它限制了从一个源加载的文档或脚本如何与来自另一个源的资源进行交互。如果您的请求涉及跨域操作(即从一个域名向另一个域名发送请求),并且服务器没有正确配置跨域资源共享(CORS),则会导致此错误。 3. 服务器错误:可能是由于服务器端的问题导致的。请检查服务器是否正常运行,并确保服务器端代码没有错误解决错误的方法包括: 1. 检查网络连接:确保您的网络连接正常,并尝试重新加载页面或重新发送请求。 2. 检查跨域请求配置:如果涉及到跨域请求,请确保服务器端已正确配置跨域资源共享(CORS)。 3. 检查服务器端代码:如果问题是由服务器端引起的,请检查服务器端代码是否正确,并确保服务器正常运行。 4. 使用其他网络请求方式:如果使用的是 XMLHttpRequest(XHR),可以尝试使用其他网络请求方式,如 Fetch API 或 axios 等。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值