Sub topic 12
Review privacy settings and content exclusion
This chapter assumes you have already installed the GitHub Copilot extension, signed in, and used inline suggestions and Chat. It also assumes you can open VS Code settings and edit settings.json. You will learn which privacy controls exist, where each one lives, and what each one does and does not protect.
Where privacy controls live
Copilot privacy is spread across four places. Knowing which place owns which control saves a lot of searching.
| Control | Where you set it | Who can set it | What it governs |
|---|---|---|---|
| Suggestions matching public code | GitHub account settings, Copilot page | You (individual plans) or the organization (Business and Enterprise) | Whether suggestions that match public code are shown or blocked |
| Data use for product improvement or model training | GitHub account settings, Copilot page | You (individual plans) | Whether GitHub may use your prompts and suggestions to improve its products |
| Content exclusion | Repository, organization, or enterprise settings on GitHub | Repository admins, organization owners, enterprise owners | Which files Copilot must ignore |
| Per-language enablement | VS Code `settings.json` | You | Where inline suggestions appear in your editor |
The first three are stored on GitHub, so they follow your account or organization to every machine. The last one is stored in VS Code and affects only that editor profile or workspace.
GitHub renames and rearranges these options from time to time. If a label in this chapter does not match what you see, look for the setting with the same purpose.
Settings on your GitHub account
Open github.com, go to your account settings, and choose Copilot. On individual plans (Free, Pro, Pro+) you will see the options you control yourself. Three matter for privacy.
Suggestions matching public code
Copilot can occasionally produce a suggestion that closely matches code in public GitHub repositories. This setting has two values:
- Allowed: Copilot may show matching suggestions.
- Blocked: Copilot checks suggestions against public code and withholds close matches.
Choose Blocked if you work somewhere with licensing rules about copied code. Blocking reduces the chance of a licensing problem. It does not remove the need to review what you accept, because the filter checks for close matches and cannot judge the license of everything Copilot writes.
On Business and Enterprise plans, the organization sets this value, and you may not be able to change it.
Data use for product improvement
Individual plans include an option that lets GitHub use your data, such as prompts and suggestions, to improve its products and models. Read the description on the settings page and set it to match your own and your employer's expectations. If you use a personal account for work code, check your employer's policy before you leave this on.
Copilot Business and Enterprise are handled differently. For those plans, GitHub states that it does not use your prompts and suggestions to train its models. Check the current Copilot trust and data documentation for exact retention terms, because they differ by plan and feature.
Which account you are signed in with
The account matters as much as the toggles. If VS Code is signed in with a personal account, the personal plan's rules apply, even when you are editing company code. If you are signed in through an organization seat, the organization's policies apply. Check the account name in the VS Code Accounts menu (bottom of the Activity Bar) before you open sensitive projects.
Content exclusion
Content exclusion tells Copilot to ignore specific files. It is the right tool for files that should never leave your machine as context, such as configuration with credentials, generated secrets, or proprietary algorithms.
Content exclusion is available on Copilot Business and Enterprise. It is not available on Free, Pro, or Pro+ plans. If you are on an individual plan, use the other controls in this chapter and keep secrets out of any file you open with Copilot active.
What an excluded file does
When a file is excluded, Copilot does the following for it:
- It does not offer inline suggestions inside that file.
- It does not use the file's contents as context to generate suggestions in other files.
- It does not use the file's contents to answer in Copilot Chat.
Who configures it
Exclusions can be set at three levels:
- Repository: a repository administrator sets it under the repository's Settings, in the Copilot section, under content exclusion. It applies to that repository.
- Organization: an organization owner sets it under the organization's Copilot settings. It can target specific repositories or all of them.
- Enterprise: an enterprise owner sets it for the whole enterprise.
You write the rules as a YAML list of paths. A repository-level example looks like this:
- "/secrets.json"
- "/config/production/*"
- "*.pem"
- "**/credentials*"The rules mean:
/secrets.jsonexcludes one file at the repository root./config/production/*excludes everything directly inside that folder.*.pemexcludes any file with that extension.**/credentials*excludes files whose names start withcredentialsin any folder.
Organization-level rules name the repository, or use "*" to cover every repository the owner can reach:
"*":
- "**/*.env"
octo-org/payments-service:
- "/src/pricing/engine.ts"Here every repository ignores .env files, and one named repository also hides a single source file.
When changes take effect
Rules are fetched by the editor from GitHub, so a new rule does not apply instantly. Propagation can take up to about 30 minutes. To pick up a change sooner, reload VS Code with the Developer: Reload Window command from the Command Palette. Test a new rule by opening an excluded file and confirming that suggestions stop. VS Code also shows an indicator on the Copilot status icon that the file is excluded.
Limits you should know
Content exclusion is a control with gaps. Treat it as one layer, not a guarantee.
- GitHub's documentation notes that exclusion is not supported in every Copilot feature in every editor. In VS Code, Edit mode and Agent mode have been listed as not fully covered. Check the current documentation for your version, and avoid pointing those modes at sensitive files.
- Copilot may still receive some information about excluded code that comes from the editor's language services, such as type signatures or symbol names from your language server.
- Exclusion governs what Copilot reads. It does not prevent you from pasting an excluded file's contents into a chat message yourself.
Controlling Copilot in the editor
Whatever your plan, you can limit where Copilot runs in VS Code. The github.copilot.enable setting maps language IDs to true or false. The * key is the default for all languages.
{
"github.copilot.enable": {
"*": true,
"plaintext": false,
"markdown": false,
"dotenv": false,
"properties": false
}
}This keeps suggestions on for most languages and turns them off for plain text and Markdown, where you may write notes or drafts. It also turns them off for .env and .properties files, which commonly hold secrets. The language ID is what VS Code shows in the status bar language picker, so check there if a rule seems not to work.
You can place this setting in your user settings to cover every project, or in .vscode/settings.json to cover one workspace. A workspace value overrides the user value for that project.
You can also pause suggestions quickly. Click the Copilot icon in the status bar to see an option that disables completions for the current language or globally. Use this when you are about to open a file that contains secrets.
What this setting does not cover
github.copilot.enable governs inline suggestions. It does not stop you from asking Chat about a file, and it is not a content exclusion. Copilot may still read a file you attach to Chat as context, such as with #file, even in a language you disabled for inline suggestions. If you must keep a file private, use content exclusion where available, and otherwise do not attach or open that file in a Copilot session.
VS Code telemetry
VS Code has its own telemetry level, separate from Copilot. You can change it with the telemetry.telemetryLevel setting.
{
"telemetry.telemetryLevel": "error"
}The accepted values are all, error, crash, and off. This controls usage data that VS Code sends to Microsoft. It is not the same as the Copilot data-use option on GitHub. Review both if your organization has telemetry rules.
Choosing which control to use
Checking your configuration
Work through this short audit once per machine and once per new project:
- Confirm the signed-in account in the VS Code Accounts menu.
- Open github.com account settings, Copilot, and review the public-code and data-use options.
- If you are on Business or Enterprise, ask the administrator which content exclusion rules exist, and confirm they cover your secret files.
- Check
github.copilot.enablein user and workspace settings for languages that hold secrets. - Open an excluded file and verify that inline suggestions stop.
Common mistakes
- Assuming exclusion exists on every plan. It does not on individual plans, so a rule you expect is never applied.
- Expecting instant effect. A new rule can take a while to reach VS Code. Reload the window before concluding it failed.
- Confusing language settings with exclusion. Turning off a language stops inline suggestions only.
- Wrong path syntax. A leading
/anchors to the repository root. Without it, a pattern like*.pemmatches anywhere. Check which you meant. - Ignoring the account. A personal sign-in on a work repository applies personal-plan rules.
Exercise
You are on a Copilot Pro plan and your project has a secrets.env file. A teammate says "just add it to content exclusion." Why will that not work, and what two steps in VS Code and your workflow would you take instead?
Show answer
Content exclusion is available only on Copilot Business and Enterprise, so a Pro plan has no place to configure it. Instead, set github.copilot.enable so the language for the file (for example dotenv) is false, which stops inline suggestions there, and avoid opening the file or attaching it to Chat with #file. Longer term, move the secrets into environment variables or a secrets manager.
Exercise
An organization owner adds the rule "**/*.pem" to the organization content exclusion settings. Ten minutes later, you still get suggestions in a .pem file. Name two likely reasons and one action to try.
Show answer
The rule may not have propagated yet, since changes can take up to about 30 minutes, and you may be using a mode that content exclusion does not fully cover, such as Edit or Agent mode. Run Developer: Reload Window to refetch the rules, then retest in a file where you use inline suggestions.
Exercise
Your company forbids copying code from public repositories into its codebase. Which GitHub account setting should you check, and what value do you want?
Show answer
Check "Suggestions matching public code" on the Copilot page of your GitHub account settings (or ask your organization administrator on Business and Enterprise plans) and set it to Blocked.