使用VS code连接ssh主机下载vscode-server-linux-x64.tar.gz报错 wget download failed手工解决方法分享

使用VS code扩展ssh-remote第一次连接ssh终端时由于网络原因下载vscode-server-linux-x64.tar.gz到远程ssh主机报错:

root@targethostip's password: 
2ea34f278e7f: running
Acquiring lock on /root/.vscode-server/bin/26076a4de974ead31f97692a0d32f90d735645c0/vscode-remote-lock.26076a4de974ead31f97692a0d32f90d735645c0
Installing to /root/.vscode-server/bin/26076a4de974ead31f97692a0d32f90d735645c0...
Downloading with wget
wget download failed


解决方法:
step 1: 当报错wget download failed时,到远程目标机器上看下下载链接
ps -ef|grep wget
root     29373 29372  0 02:16 ?        00:00:00 wget --tries=1 --connect-timeout=7 --dns-timeout=7 -nv -O vscode-server-linux-x64.tar.gz https://update.code.visualstudio.com/commit:26076a4de974ead31f97692a0d32f90d735645c0/server-linux-x64/stable
找一台可以科学上网的机器手工下载
wget  -O vscode-server-linux-x64.tar.gz https://update.code.visualstudio.com/commit:26076a4de974ead31f97692a0d32f90d735645c0/server-linux-x64/stable
step 2: 将手工下载的文件上传到远程目标机器上,我这里放在根目录暂存
cp vscode-server-linux-x64.tar.gz /vscode-server-linux-x64.tar.gz
step 3: 修改本地机器上的脚本文件 C:\Users\administrator\.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.35.0\out\extension.js
搜索 "wget ${function(e){return e?"--tries=1":""}(!!d)} --connect-timeout=7 --dns-timeout=7 -nv -O vscode-server-linux-$VSCODE_ARCH.tar.gz https://update.code.visualstudio.com/commit:$COMMIT_ID/server-linux-$VSCODE_ARCH${u?"-web":""}/${r}" (双引号以内内容)
替换为 "cp /vscode-server-linux-x64.tar.gz ."(双引号以内内容)

retry,跳过下载环节

使用VS code连接ssh主机下载vscode-server-linux-x64.tar.gz报错 wget download failed手工解决方法分享_第1张图片

试过将包下载后手动解压到指定目录的方法,但发现再次连接时会检测到已有老版本会删除老文件又会重新下载,此方法最简单。

你可能感兴趣的:(Visual,Studio,Code,ssh-remote)