首页 > 解决方案 > 使用vscode远程ssh失败,但是直接使用ssh可以工作

问题描述

问题

我重新安装了我的服务器系统。在此之前,我可以正常使用remote-ssh。但是,我不能再使用remote-ssh连接到我的服务器了。但是我仍然可以直接使用ssh连接到服务器。
我想它设法进入了系统,但不知何故它坏了。
错误日志如下:

Welcome to Ubuntu 20.04 LTS (GNU/Linux 5.4.0-77-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Tue 14 Sep 2021 09:56:58 PM CST

  System load:  0.07              Processes:             117
  Usage of /:   6.5% of 59.00GB   Users logged in:       1
  Memory usage: 10%               IPv4 address for eth0: 10.0.12.2
  Swap usage:   0%

 * Super-optimized for small spaces - read how we shrank the memory
   footprint of MicroK8s to make it the smallest full K8s around.

   https://ubuntu.com/blog/microk8s-memory-optimisation

ready: 6425958cce28
Linux 5.4.0-77-generic #86-Ubuntu SMP Thu Jun 17 02:35:03 UTC 2021
6425958cce28: running
bash: line 1: _exitcode: command not found
bash: line 2: syntax error near unexpected token `elif'
bash: line 2: ` elif [[ $ALLOW_CLIENT_DOWNLOAD == "1" ]]; then'
-sh: 4: function: not found
-sh: 69: [[: not found
-sh: 90: [[: not found
-sh: 155: Syntax error: "(" unexpected (expecting "then")
Transferred: sent 17180, received 4016 bytes, in 0.5 seconds
Bytes per second: sent 35433.6, received 8283.0
local-server-1> ssh child died, shutting down

[21:56:58.587] Failed to parse remote port from server output
[21:56:58.588] Resolver error: Error: 
    at Function.Create (/Users/luther/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.7/out/extension.js:1:64659)
    at Object.t.handleInstallOutput (/Users/luther/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.7/out/extension.js:1:63302)
    at Object.e [as tryInstallWithLocalServer] (/Users/luther/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.7/out/extension.js:1:387573)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async /Users/luther/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.7/out/extension.js:1:294473
    at async Object.t.withShowDetailsEvent (/Users/luther/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.7/out/extension.js:1:406463)
    at async /Users/luther/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.7/out/extension.js:1:386112
    at async E (/Users/luther/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.7/out/extension.js:1:382710)
    at async Object.t.resolveWithLocalServer (/Users/luther/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.7/out/extension.js:1:385728)
    at async Object.t.resolve (/Users/luther/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.7/out/extension.js:1:295870)
    at async /Users/luther/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.7/out/extension.js:127:110656
[21:56:58.592] ------

试过了

我尝试从主机中删除 know_hosts 文件,重新安装 remote-ssh 插件,但无法工作

我对远程 ssh 很陌生,希望能给我更详细的解决方案。
谢谢 :)

标签: sshvscode-remote

解决方案


我降级了remote-ssh。然后我将我的默认shell更改为zsh并升级remote-ssh。它再次开始安装'.vscode-server'文件并且神奇地工作了。


推荐阅读