Jo Liss
Jo Liss

Reputation: 33104

Can you make GitHub Copilot opt-in on a per-project basis?

I'm using the VS Code GitHub Copilot extension. Sometimes I edit files that contain secrets, and I don't want to accidentally send those to Microsoft/GitHub.

Is it possible to make Copilot opt-in, so that it is only enabled if I have explicitly activated it for a project?

Upvotes: 12

Views: 4274

Answers (3)

Viktor Sec
Viktor Sec

Reputation: 3085

You can do it in the UI, but it's a bit hidden.

Go to Settings -> Extensions -> GitHub Copilot -> Disable

Then click on the dropdown arrow next to the Enable button and choose Enable (Workspace)

screenshot of the Enable dropdown

Upvotes: 11

iron9
iron9

Reputation: 525

You can currently enable/disable Copilot only globally for the user or on a per-language basis through the UI.

However, you can disable Copilot globally and overwrite the setting directly in the settings.json file for a specific workspace. For that, edit or create the file .vscode/settings.json with this content:

{
  "github.copilot.enable": {
    "*": true,
    "plaintext": false,
    "markdown": false,
    "scminput": false
  },
}

As noted in the comments, the UI can guide you a little:

  • Go to "Settings"
  • Search for "copilot"
  • Click the "User" tab to globally configure
  • Click the "Workspace" tab to configure for a single workspace

You still need to edit settings.json but at least you get a handy button that opens it for editing for you, with default values.

Upvotes: 5

Chirag
Chirag

Reputation: 108

You can disable the extension and then enable for only the projects and workspaces you want it to be enabled.

Upvotes: 3

Related Questions