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

如何不在devcontainer.json中指定github.copilot仍能跨设备自动加载?

可行,操作方法如下

1. 修改项目公共配置

先从项目根目录的.devcontainer/devcontainer.json中移除github.copilot扩展项,修改后的配置如下:

// Documentation:
//  - https://github.com/devcontainers/images/tree/main/src/jekyll
//  - https://github.com/devcontainers/features/tree/main/src/node

{
    "name": "Jekyll",
    "image": "mcr.microsoft.com/devcontainers/jekyll",
    "features": {
        // Install latest stable Node
        "ghcr.io/devcontainers/features/node:1": {
            "version": "lts"
        }
    },
    "customizations": {
        "vscode": {
            "extensions": [
                "html-validate.vscode-html-validate"
            ]
        }
    }
}

将这个修改提交到公共仓库,其他用户拉取后就不会自动安装Copilot了。

2. 配置个人设备自动加载Copilot

你可以通过VS Code的用户级工作区特定设置,让自己的设备打开该项目时自动加载Copilot,操作步骤:

  • 打开VS Code,按下快捷键Ctrl+,(Windows/Linux)或Cmd+,(Mac)打开设置面板
  • 点击面板右上角的**打开设置(JSON)**图标({}形状)
  • 在用户settings.json中添加以下配置,把/path/to/your/project替换为你本地该项目的绝对路径:
{
  "[workspaceFolder:/path/to/your/project]": {
    "remote.containers.defaultExtensions": ["github.copilot"]
  }
}

保存设置后,下次你打开该项目的Dev Container时,VS Code会自动为你加载GitHub Copilot扩展,且这个配置只保存在你的本地设备,不会同步到公共仓库。

如果有多个设备,还可以通过VS Code的设置同步功能,将这个用户设置同步到所有绑定的设备上,无需逐个配置。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.24 05:28:15