You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

无网络环境下运行VSCode Tunnel遇提前登录请求的问题咨询

问题:无网络虚拟机运行VS Code Tunnel时提前触发登录请求,不符合文档步骤

我尝试在无网络访问的虚拟机(VM)上,按照VS Code官方文档运行VS Code Tunnel,但在步骤2就遇到了登录请求,终端输出如下:

./code tunnel --accept-server-license-terms --verbose
*
* Visual Studio Code Server
*
* By using the software, you agree to
* the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-license) and
* the Microsoft Privacy Statement (https://privacy.microsoft.com/en-US/privacystatement).
*
[2024-02-12 09:29:21] debug Starting tunnel with `code ./code tunnel --accept-server-license-terms --verbose`
[2024-02-12 09:29:21] debug starting as new singleton
[2024-02-12 09:29:21] debug No code server tunnel found, creating new one
[2024-02-12 09:29:21] debug Using file keychain storage due to: error reading keyring: Platform secure storage failure: no secret service provider or dbus session found
[2024-02-12 09:29:21] trace No token in keyring, getting a new one
? How would you like to log in to Visual Studio Code? ›
❯ Microsoft Account
  Github Account

根据文档预期,登录请求应该在步骤4出现。请问是否有选项可以推迟该登录步骤?或者文档是否已过时?


回答

  • 没有推迟登录的官方选项:VS Code Tunnel的CLI当前没有提供跳过或推迟登录的参数。因为隧道的创建和关联必须依赖微软/GitHub账号的身份令牌,当本地密钥环中没有有效令牌时,系统会直接触发登录流程,不会等待后续步骤。
  • 文档大概率已过时:这种登录流程前置的情况,是因为VS Code Tunnel的CLI版本更新后,身份验证环节被调整到了隧道初始化的早期步骤,而官方文档没有同步更新这一变化,导致和实际操作流程不符。
  • 无网络环境的替代方案:需要注意的是,VS Code Tunnel本身依赖网络完成身份验证、隧道注册和后续通信,完全无网络的虚拟机无法正常运行Tunnel。可以尝试以下替代方案:
    1. 先在有网络的环境中完成登录,导出身份令牌后复制到无网络虚拟机中配置(注意令牌存在有效期限制)
    2. 改用无需联网的远程开发方案,比如直接通过SSH连接虚拟机进行开发

内容的提问来源于stack exchange,提问作者Fractaliste

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.30 00:45:11