前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >vscode-1.64之后版本remote-ssh到远端失败

vscode-1.64之后版本remote-ssh到远端失败

作者头像
Homqyy
发布2023-03-06 13:24:42
8980
发布2023-03-06 13:24:42
举报
文章被收录于专栏:知行合一知行合一

问题原因

原因是1.64之后vscode加入了“接受条约”的要求,强制要求用户需要去阅读确认后手动修改以表明接受其声明。

解决方案

话不多说直接看问题,我们发现remote-ssh控制台日志上有一个标志性错误信息:

代码语言:javascript
复制
server.sh is being replaced by 'bin/code-server'. Please migrate to the new comm
and and adopt the following new default behaviors:

connection token is mandatory unless --without-connection-token is used
host defaults to localhost
Visual Studio Code Server
By using the software, you agree to
the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-lice
nse) and
the Microsoft Privacy Statement (https://privacy.microsoft.com/en-US/privacyst
atement).
To accept the license terms, start the server with --accept-server-license-terms

如上所示,大致意思是,在启动vscode-server服务时需要通过--without-connection-token参数携带token或则携带--accept-server-license-terms参数来表明接受其条约。条约可以查看站点:https://aka.ms/vscode-server-license

看完应该就明白了,这里我采用上述的第二种方案,即在启动vscode-server的时候携带--accept-server-license-terms参数:

1.打开远端服务器的文件(vi ~/.vscode-server/bin/${hash}/server.sh),文件内容如下所示:

代码语言:javascript
复制
#!/usr/bin/env sh
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#

case "$1" in
	--inspect*) INSPECT="$1"; shift;;
esac

ROOT="$(dirname "$0")"

"$ROOT/node" ${INSPECT:-} "$ROOT/out/server-main.js" --compatibility=1.63 "$@"

2.追加--accept-server-license-terms参数,修改后的文件如下所示:

代码语言:javascript
复制
#!/usr/bin/env sh
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#

case "$1" in
	--inspect*) INSPECT="$1"; shift;;
esac

ROOT="$(dirname "$0")"

"$ROOT/node" ${INSPECT:-} "$ROOT/out/server-main.js" --compatibility=1.63 --accept-server-license-terms "$@"

3.再次用vscode连接远端机器,发现连接成功。

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2022年4月23日2,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 问题原因
  • 解决方案
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档