我想使用Visual代码(VSCode)远程开发扩展。
我尝试了“远程- SSH :连接到主机”命令,并且似乎正确地建立了到主机服务器的SSH连接。
但是,我遇到了一个错误:
Could not establish connection to "<hostname>". Cannot read property 'split' of undefined.当我查看输出消息时,错误发生如下所示:
[10:13:08.492] Using cwd: vscode-remote://ssh-remote%2B<hostname>/
[10:13:08.492] Remote extension host environment: {"SSH_AUTH_SOCK":"/tmp/vscode-ssh-auth-sock-<id?>"}
[10:13:08.512] Resolver error: Cannot read property 'split' of undefined我的环境是这样的:
(10.15.6)
如果你能帮我解决这件事,我很感激。
发布于 2022-03-09 11:32:50
我不太明白为什么会出现这个问题。但是,我能够通过删除用于持久化连接细节的文件来克服这个问题。您可以在vscode输出选项卡中看到该文件的路径。文件路径与此类似(MacOS上的路径):/Users/xxxxxx/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-d1856b0f-aaaaa2d23e12e5afa3e5c21c1c7abc4657061234-0.66.1/data.json
发布于 2020-09-12 03:09:32
谢谢你检查我的问题。
我能够通过修改ssh配置来解决这个问题。
我在多阶段ssh中使用了LocalForward设置,如下所示。
Host <ssh_hostname>
HostName <hostname>
User <usename>
LocalForward <port_A> localhost:<port_B>
ProxyCommand ssh -CW %h:%p <other_ssh_hostname>
RemoteForward <port_C> localhost:<port_D>我注释掉了LocalFoward设置,它起作用了!
Host <ssh_hostname>
HostName <hostname>
User <usename>
# LocalForward <port_A> localhost:<port_B>
ProxyCommand ssh -CW %h:%p <other_ssh_hostname>
RemoteForward <port_C> localhost:<port_D>我不知道为什么使用LocalForward会导致这个问题,但暂时能够解决它。
再次感谢您。
https://stackoverflow.com/questions/63821603
复制相似问题