服务器环境 VS Code GitHub Copilot 加载超时问题:优化与修复方案
当在服务器环境使用 VS Code 的 GitHub Copilot 时,加载超时通常由网络配置或资源限制引起。以下是结构化解决方案:
1. 网络层优化
配置代理(若需跨墙)
在 VS Code 的 settings.json 添加:
{
"http.proxy": "http://your-proxy-ip:port",
"https.proxy": "http://your-proxy-ip:port",
"http.proxyStrictSSL": false
}
检查防火墙规则 确保服务器开放对 Copilot 服务的访问权限:
telnet copilot-proxy.githubusercontent.com 443
若连接失败,需在防火墙放行以下域名:
*.githubusercontent.com *.github.com
2. 认证问题修复
- 重新激活 Copilot 执行以下步骤:
- VS Code 命令面板 >
GitHub Copilot: Sign Out - 重启 VS Code
- 命令面板 >
GitHub Copilot: Sign In - 按提示完成设备授权流程
检查令牌有效期 访问 GitHub 设置页:
Settings > Developer settings > GitHub Copilot
确认访问令牌未过期(通常有效期为 90 天)
3. 服务器资源调整
提升进程优先级 在 Linux 服务器调整 VS Code 进程的 nice 值:
renice -n -10 -p $(pgrep -f "code-server")
增加超时阈值
在 settings.json 添加:
{
"github.copilot.advanced": {
"timeout":

