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

远程服务器VS Code中GitHub Copilot突然无法使用问题求助

解决远程服务器GitHub Copilot超时问题

问题背景

远程服务器上的GitHub Copilot突然无法工作,本地VS Code的Copilot可正常使用;已确认服务器能ping通api.github.com,但日志显示请求https://api.github.com/copilot_internal/v2/token超时,且连接140.82.112.21:443失败。

错误日志

2024-09-22 23:06:59.151 [error] [auth] auth: HttpTimeoutError: Request to <https://api.github.com/copilot_internal/v2/token> timed out after 120000ms
    at /home/xhl/.vscode-server/extensions/github.copilot-1.232.0/lib/src/network/helix.ts:95:19
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at Hne.fetch (/home/xhl/.vscode-server/extensions/github.copilot-1.232.0/lib/src/network/helix.ts:93:22)
    ... 5 lines matching cause stack trace ...
    at attemptAuthentication (/home/xhl/.vscode-server/extensions/github.copilot-1.232.0/extension/src/auth.ts:58:9) {
  cause: AbortError: The operation was aborted.
      at fetch (/home/xhl/.vscode-server/extensions/github.copilot-1.232.0/node_modules/@adobe/helix-fetch/src/fetch/index.js:96:13)
      at processTicksAndRejections (node:internal/process/task_queues:95:5)
      at cachingFetch (/home/xhl/.vscode-server/extensions/github.copilot-1.232.0/node_modules/@adobe/helix-fetch/src/fetch/index.js:288:16)
      at Hne.fetch (/home/xhl/.vscode-server/extensions/github.copilot-1.232.0/lib/src/network/helix.ts:93:22)
      at fetchCopilotToken (/home/xhl/.vscode-server/extensions/github.copilot-1.232.0/lib/src/auth/copilotToken.ts:196:16)
      at authFromGitHubToken (/home/xhl/.vscode-server/extensions/github.copilot-1.232.0/lib/src/auth/copilotToken.ts:129:22)
      at auth (/home/xhl/.vscode-server/extensions/github.copilot-1.232.0/extension/src/auth.ts:40:25)
      at authShowWarnings (/home/xhl/.vscode-server/extensions/github.copilot-1.232.0/extension/src/auth.ts:131:25)
      at yX.getCopilotToken (/home/xhl/.vscode-server/extensions/github.copilot-1.232.0/extension/src/auth.ts:174:33)
      at attemptAuthentication (/home/xhl/.vscode-server/extensions/github.copilot-1.232.0/extension/src/auth.ts:58:9) {
    type: 'aborted',
    _name: 'AbortError'
  }
}
2024-09-22 23:06:59.151 [error] [auth] Request to <https://api.github.com/copilot_internal/v2/token> timed out after 120000ms
2024-09-22 23:07:26.568 [error] [default] Error sending telemetry FetchError: connect ETIMEDOUT 140.82.112.21:443
    at fetch (/home/xhl/.vscode-server/extensions/github.copilot-1.232.0/node_modules/@adobe/helix-fetch/src/fetch/index.js:99:11)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at cachingFetch (/home/xhl/.vscode-server/extensions/github.copilot-1.232.0/node_modules/@adobe/helix-fetch/src/fetch/index.js:288:16)
    at Hne.fetch (/home/xhl/.vscode-server/extensions/github.copilot-1.232.0/lib/src/network/helix.ts:93:22) {
  type: 'system',
  _name: 'FetchError',
  code: 'ETIMEDOUT',
  errno: -110,
  erroredSysCall: 'connect'
}

解决方案

  • 验证TCP 443端口连通性:ping仅验证ICMP可达,需测试HTTPS端口。执行以下命令:

    telnet api.github.com 443
    # 或用curl测试具体请求
    curl -v https://api.github.com/copilot_internal/v2/token
    

    如果无法建立连接,说明服务器出站443端口被限制。

  • 检查防火墙/安全组规则:确认远程服务器的防火墙、云服务商安全组允许出站访问api.github.com和copilot-proxy.githubusercontent.com的443端口。

  • 重置Copilot认证状态:在远程VS Code中按Ctrl+Shift+P(Mac为Cmd+Shift+P),输入GitHub Copilot: Sign Out,完成后重新登录账号。

  • 更新/重装Copilot扩展:在远程VS Code的扩展面板中,更新GitHub Copilot到最新版本;若问题依旧,卸载后重新安装,同时检查/home/xhl/.vscode-server/extensions目录的读写权限是否正常。

  • 调整VS Code代理设置:打开远程VS Code的设置(Ctrl+,),搜索http.proxy,若服务器无需代理,清空该设置并将http.proxySupport设为off;若需代理,配置正确的代理地址。

  • 测试Copilot专用域名:执行telnet copilot-proxy.githubusercontent.com 443,确认该域名的443端口可连通,部分环境可能仅限制Copilot的专用服务域名。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.18 06:29:54