Skip to main content

使用 VSCode ssh 远程连接服务器时卡在 "Downloading VS Code Server"

· One min read
therainisme

进行远程连接时,尝试在服务器下载 Remote-SSH 的服务端失败了,极大概率是国内网络的原因。

Server download failed
Downloading VS Code Server failed. Please try again later.

解决方法 1(自动)

如果本机有代理工具的话,可以将 VS Code 配置的 Remote.SSH: Local Server Download 设置为 always。这样它会在本地下载 VSCode Server,然后通过 scp 上传到服务器上。

解决方法 2(手动)

使用以下命令后,看看 VSCode 下载的是哪个 commit-id 的版本:

ls ~/.vscode-server/bin

接着手动下载那个版本的 VSCode Server,然后解压到 ~/.vscode-server/bin/<commit-id> 目录下。

commit_id=f06011ac164ae4dc8e753a3fe7f9549844d15e35

# Download url is: https://update.code.visualstudio.com/commit:${commit_id}/server-linux-x64/stable
curl -sSL "https://update.code.visualstudio.com/commit:${commit_id}/server-linux-x64/stable" -o vscode-server-linux-x64.tar.gz

mkdir -p ~/.vscode-server/bin/${commit_id}
tar zxvf vscode-server-linux-x64.tar.gz -C ~/.vscode-server/bin/${commit_id} --strip 1
touch ~/.vscode-server/bin/${commit_id}/0

参考资料

  1. How can I install vscode-server in linux offline