vscode:could not establish connection xxx 问题的解决

当出现这个问题的时候,报错:

[15:44:00.161] Running script with connection command: "C:\Windows\System32\OpenSSH\ssh.exe" -T -D 50503 "121.199.33.139" bash
[15:44:00.164] Terminal shell path: C:\Windows\System32\cmd.exe
[15:44:00.416] > ]0;C:\Windows\System32\cmd.exe
[15:44:00.416] Got some output, clearing connection timeout
[15:44:00.446] > Bad owner or permissions on C:\\Users\\little scurry/.ssh/config
> 过程试图写入的管道不存在。
> 
[15:44:01.699] "install" terminal command done
[15:44:01.699] Install terminal quit with output: 过程试图写入的管道不存在。
[15:44:01.700] Received install output: 过程试图写入的管道不存在。
[15:44:01.701] Failed to parse remote port from server output
[15:44:01.703] Resolver error: Error: 
	at g.Create (c:\Users\little scurry\.vscode\extensions\ms-vscode-remote.remote-ssh-0.112.0\out\extension.js:2:499918)
	at t.handleInstallOutput (c:\Users\little scurry\.vscode\extensions\ms-vscode-remote.remote-ssh-0.112.0\out\extension.js:2:497240)
	at t.tryInstall (c:\Users\little scurry\.vscode\extensions\ms-vscode-remote.remote-ssh-0.112.0\out\extension.js:2:621085)
	at async c:\Users\little scurry\.vscode\extensions\ms-vscode-remote.remote-ssh-0.112.0\out\extension.js:2:580730
	at async t.withShowDetailsEvent (c:\Users\little scurry\.vscode\extensions\ms-vscode-remote.remote-ssh-0.112.0\out\extension.js:2:584036)
	at async k (c:\Users\little scurry\.vscode\extensions\ms-vscode-remote.remote-ssh-0.112.0\out\extension.js:2:577649)
	at async t.resolve (c:\Users\little scurry\.vscode\extensions\ms-vscode-remote.remote-ssh-0.112.0\out\extension.js:2:581407)
	at async c:\Users\little scurry\.vscode\extensions\ms-vscode-remote.remote-ssh-0.112.0\out\extension.js:2:848023

主要是两个报错:

1.权限问题:Bad owner or permissions on C:\\Users\\little scurry/.ssh/config

2.管道错误:试图写入的管道不存在

第一个报错解决:

按 Win + X,选择“Windows PowerShell(管理员)”或“命令提示符(管理员)”。
icacls "C:\\Users\\little scurry\\.ssh\\config" #确定文件所有权
takeown /f "C:\\Users\\little scurry\\.ssh\\config" 
icacls "C:\\Users\\little scurry\\.ssh\\config" /grant '%username%:F'  #修改文件所有权

第二个报错解决:

确保系统中安装的 OpenSSH 工具路径正确配置,并且可以正确被 VS Code Remote-SSH 插件识别。在 VS Code 中,确认 SSH 配置路径是否正确配置。可以在 VS Code 设置中搜索 remote.SSH.configFile,确保其值为 C:\Users\xxxxx\.ssh\config 或者手动设置为这个路径。

#### 我是按照我写的顺序解决的,但是我有一个猜想:不知道直接处理第二个报错能不能解决这个问题,读者可以试一下。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值