GitHub Copilot Content Exclusions and Editor Settings
30-second answer
Content exclusions stop GitHub Copilot from using chosen files. A repository admin lists paths under Settings › Copilot › Content exclusion; an organization admin writes YAML that maps repositories (or "*" for all) to paths; enterprises can set them too. In supported IDEs an excluded file gets no inline suggestions and isn't used as context for other files. Exclusions need Copilot Business or Enterprise, can take up to 30 minutes to reach an open IDE, show up in the audit log, and don't apply to every Copilot feature. Separately, the github.copilot.enable editor setting turns completions on or off per language for you only.
Exam objective: 6.1.1 Configure content exclusions and editor settings. 2.1.3 Configure content exclusions for specific files or repositories (app knowledge). (Skills measured as of August 7, 2026)
Simulations
Feel it before you read it. No account needed, nothing leaves this page.
In <strong>repository settings › Copilot › Content exclusion</strong>, list the paths Copilot must ignore. Organization and enterprise admins can exclude paths across many repositories.
👆 Click the glowing item on screen to continue
Read the steps as text
- In repository settings › Copilot › Content exclusion, list the paths Copilot must ignore. Organization and enterprise admins can exclude paths across many repositories.
- At the organization level, write YAML: a repository name (or "" for all) and its paths.
- Open an excluded file and the Copilot status icon shows it’s excluded: no inline suggestions, and the file isn’t used as context for other files.
- Editor settings are personal: turn completions off for languages such as plaintext or YAML. Note that exclusions don’t cover every Copilot feature, so check the docs for the ones you rely on.
🧪 Simulation for learning. Screens are simplified versions of Visual Studio Code and github.com with GitHub Copilot; names, files and suggestions are examples. Not affiliated with GitHub or Microsoft, and nothing here touches your real account.
🖱️ Drag to rotate · scroll or pinch to zoom
Content exclusions
Repository, organization and enterprise admins can exclude files and paths. Copilot won’t use them as context or suggest inside them in supported IDEs. Changes can take up to 30 minutes to reach editors.
🤔 What happens if…
Read this tour as text
- Plans and seats. Individuals use Copilot Free, Pro or Pro+. Organizations buy Copilot Business per seat; Copilot Enterprise adds features on GitHub Enterprise Cloud. Admins assign seats to users or teams.
- Policies flow down. An enterprise can enforce a Copilot policy for all its organizations or leave the choice to each organization. Policies cover features (chat in the IDE, on github.com, the CLI, code review, agents), models and MCP.
- Seats light up Copilot. A developer gets Copilot once they have a seat. Remove the seat and Copilot stops at the end of the billing cycle.
- Suggestions matching public code. A policy decides what happens when a suggestion matches public code: Block hides it; Allow shows it with a code reference (repository and licence) so you can decide.
- Content exclusions. Repository, organization and enterprise admins can exclude files and paths. Copilot won’t use them as context or suggest inside them in supported IDEs. Changes can take up to 30 minutes to reach editors.
- Audit log and metrics. Copilot settings changes, seat assignments and content exclusion changes appear in the audit log. Usage metrics and the REST API show adoption and activity.
- Responsible use. Policies reduce risk, but the developer still owns the output: review it, test it, scan it for vulnerabilities and check licences before it ships.
- Troubleshooting. No suggestions? Check the seat and sign-in, whether the file is excluded, whether the language is disabled in settings, the public code filter, network or proxy settings, and the Copilot logs in the IDE.
A free terminal with GitHub Copilot CLI, git and gh. No tasks: install the CLI, start a session, try slash commands and tool permissions, or call the seats API.
🎓 Education-only simulation. Your lab is saved in this browser, so you can leave and continue later.
😟 THE PROBLEM
Copilot could read a folder of production keys as context.
😊 THE SOLUTION
Exclude sensitive paths in repository or organization settings.
- Secrets as context✓ Exclude /secrets/**
- Many repositories✓ Org-level exclusions
- Change not visible yet✓ Up to 30 minutes, or reload
Start with a question
The payment key lives in config/secrets.js, and that file is open in a tab while you code. Is Copilot reading it?
It can. When you’re typing in src/cart.js, Copilot builds its prompt from the code around your cursor and from snippets in your other open tabs. If config/secrets.js is one of those tabs, bits of it may be sent along.
Nobody did anything wrong here. That’s how Copilot finds useful context. But your security team would rather that file never went anywhere, and asking 40 developers to “close that tab” isn’t a control.
A content exclusion is the control. An admin lists the path once, and Copilot leaves that file alone for everyone in the repository.
Explain it like I’m 10
Visual: Content exclusions in motion
Watch a secret file get pulled into Copilot’s context, then left out once an admin excludes it.
Read the video script
- Copilot reads your open tabsYou're working in cart.js in the contoso-shop repo. To suggest the next line, Copilot sends the code around your cursor, plus snippets from the other files you have open.
- A secret file goes along tooBut secrets.js is open too. Nothing stops its contents from going along as context. That's the file your security team wants Copilot to ignore.
- Exclude the path in the repositoryA repository admin opens Settings, then Copilot, then Content exclusion, and adds the path. This needs Copilot Business or Enterprise.
- Give it time to reach the IDEThe change isn't instant. It can take up to thirty minutes to reach an editor that's already open. Reloading the window picks it up sooner.
- The file stays out of the promptNow when you type in cart.js, only cart.js and discount.js go into the prompt. The excluded file is left out.
- Open the excluded fileOpen secrets.js itself and you get no inline suggestions at all. The Copilot icon in the status bar tells you the file is excluded, so you know it isn't broken.
- One rule for every repositoryOrganization admins can go wider. They write a little YAML: a repo name, or a star for every repo, and the paths. Here, every dot env file in contoso is excluded.
- Know what it coversLast, know the limits. Not every Copilot feature honours exclusions, so check the docs for the ones you use. And turning Copilot off for a language in your editor is a personal choice, not a security control.
The technical explanation
Content exclusions are part of Copilot Business and Copilot Enterprise. Individual plans (Free, Pro, Pro+) don’t have them.
What an excluded file means in the IDE
In supported IDEs, when a file matches an exclusion:
- Copilot gives no inline suggestions inside it.
- Copilot doesn’t use it as context for suggestions in other files.
- The Copilot status icon says the file is excluded, so developers can tell “blocked on purpose” from “broken”.
The file isn’t hidden, encrypted or changed. You can still open and edit it. Exclusions also don’t apply to every Copilot feature, so check GitHub’s docs for the features your team relies on before you promise anything.
Three places to set them
| Level | Who | Format | Reach |
|---|---|---|---|
| Repository | Repository admin | List of paths, one per line | That repository |
| Organization | Organization owner | YAML: repository name (or "*") → paths | Named repos, or all of them |
| Enterprise | Enterprise owner | YAML, like the organization | Repositories across the enterprise |
Repository level, under Settings › Copilot › Content exclusion:
- "/config/secrets.js" # one file, from the repository root
- "/secrets/**" # everything under /secrets
- "*.pem" # any .pem file anywhere
Organization level, under Organization settings › Copilot › Content exclusion:
contoso-shop:
- "/src/legacy/report.js"
"*":
- "**/.env"
Paths use fnmatch-style patterns. A leading / anchors the path at the repository root. Without it, the pattern can match in any folder, which is sometimes what you want and sometimes a surprise.
Timing and the audit log
An exclusion change can take up to 30 minutes to reach IDEs that are already open. If a developer still sees suggestions right after you save, ask them to reload the window before you start debugging. Every change to exclusions is recorded in the organization’s audit log as a copilot. event, so you can see who changed what.
Editor settings are a different thing
Each developer can switch inline completions on or off per language in VS Code:
"github.copilot.enable": {
"*": true,
"plaintext": false,
"markdown": false,
"yaml": false
}
That’s handy when ghost text gets in the way of writing docs. But it’s personal. Anyone can flip it back, and it does nothing for the next developer. If a file is sensitive, the answer is a content exclusion set by an admin, not an editor preference.
Architect level Exclusions are a second line, not the first
An exclusion stops Copilot reading a file. It doesn’t stop the secret being in Git history, in a fork, or on a laptop. The first line is keeping secrets out of the repository: environment variables, a secrets manager, and secret scanning with push protection so a key can’t be pushed by mistake. Use exclusions for files that must live in the repo but shouldn’t feed an AI tool, such as licensed third-party code or customer data samples.
Real-world business scenario
Contoso (fictional)
- The problem
- The contoso-shop repo kept a vendor's licensed tax engine under /vendor/tax and a config file with test card numbers. Legal didn't want either used as Copilot context, and the team had 30 repositories with .env files.
- What they used
- A repository exclusion for /vendor/tax/** and /config/test-cards.json, plus one organization rule that excludes **/.env in every repository, on Copilot Business.
- Why that choice
- One org rule covered all 30 repositories, including new ones, and the audit log showed legal exactly when each rule was added.
- The result
- Developers open those files and see the excluded status instead of suggestions, and nobody has to remember to close tabs.
When to use it and when not to
✓ Use it when…
- Files with secrets, keys or customer data that must stay in the repository.
- Licensed or third-party code your legal team doesn't want used as AI context.
- An org-wide rule, such as every .env file, across many repositories.
✕ Think twice when…
- As your only protection for secrets. Keep them out of the repo and use secret scanning.
- When you only want fewer suggestions while writing docs. Use github.copilot.enable instead.
- On individual plans. Exclusions need Copilot Business or Enterprise.
↔ Alternatives to consider
- Secret scanning with push protection to stop secrets reaching the repository.
- github.copilot.enable for a personal, per-language on/off switch.
- Organization policies to turn whole Copilot features off.
Test yourself with exercises
5 original practice questions in the GH-300 style. Pick your answers, then check them. You will see why each option is right or wrong. Score 75% or more and this topic is marked complete.
Interview preparation
Say your answer out loud first, then open the model answer. Interviewers care more about your reasoning than the exact words.
Beginner What does a content exclusion actually do to a file?
Model answer
In a supported IDE, Copilot won't offer inline suggestions inside that file, and it won't pull snippets from it as context when I'm working in other files. The file itself isn't changed or hidden from me.
Interviewer follows up
How do you know it's working?
You
I open the file and look at the Copilot icon in the status bar. It says the file is excluded, and no ghost text appears.
Intermediate Where can content exclusions be set, and who can set them?
Model answer
Three places. A repository admin sets paths for one repository. An organization owner writes YAML that can target named repositories or all of them with "*". An enterprise owner can set rules across the enterprise. All of it needs Copilot Business or Enterprise.
Experienced developer A developer says they can still see suggestions in a file you excluded ten minutes ago. Is the exclusion broken?
Model answer
Probably not. Exclusion changes can take up to 30 minutes to reach an IDE that's already open. I'd ask them to reload the window, check the status icon, and confirm the path pattern actually matches the file, for example a leading slash for the repository root.
Interviewer follows up
And if it still doesn't match after a reload?
You
I'd check the pattern against the real path, check they're using a supported IDE and an up-to-date extension, and check which Copilot feature they mean, because exclusions don't cover every feature.
Scenario Your security team wants every .env file in the company ignored by Copilot. How do you do it with the least effort?
Model answer
One organization-level rule with "*" as the repository and "**/.env" as the path. That covers every repository in the org, including new ones, without touching each repository's settings. The change appears in the audit log.
Architecture & design Is turning off Copilot for YAML in VS Code a good way to protect your infrastructure files?
Model answer
No. github.copilot.enable is a personal editor setting. Anyone can switch it back, and it does nothing for other developers. If the files are sensitive, the control is a content exclusion set by an admin, backed by not storing secrets in the repo at all.
Quick revision
Key points
- Content exclusions are a Copilot Business and Enterprise feature.
- Repository level is a list of paths; organization level is YAML mapping a repository (or "*") to paths; enterprises can also set them.
- Excluded files get no inline suggestions and aren't used as context in supported IDEs.
- Changes can take up to 30 minutes to reach an open IDE. Reloading the window helps.
- Exclusions don't apply to every Copilot feature, so check the docs for the ones you rely on.
- Exclusion changes are recorded in the audit log.
- github.copilot.enable switches completions per language for one user. It isn't a security control.
Important terminology
- Content exclusion
- A Copilot Business or Enterprise setting that lists files or paths Copilot must not use for suggestions or as context.
- Repository-level exclusion
- A list of paths, one per line, set under the repository's Settings › Copilot › Content exclusion. It applies to that repository only.
- Organization-level exclusion
- YAML set by an organization owner that maps a repository name, or "*" for every repository, to the paths to exclude.
- fnmatch pattern
- The glob style used for exclusion paths, such as "/secrets/**" or "*.pem".
- github.copilot.enable
- A VS Code setting that turns Copilot inline completions on or off per language, for example off for plaintext or YAML. It's a personal preference, not a policy.
- Copilot status icon
- The icon in the IDE status bar that shows whether Copilot is working, signed out, or disabled because the file is excluded.
Common mistakes
- Treating the per-language editor setting as a way to protect sensitive files.
- Expecting an exclusion to take effect the second you save it.
- Assuming exclusions are available on Copilot Free, Pro or Pro+.
- Writing a path without the leading slash and matching the wrong files, or missing the right ones.
Exam tips
- "Stop Copilot using one folder in one repository" = repository settings › Copilot › Content exclusion.
- "Same rule for every repository in the org" = organization YAML with
"*". - "Excluded but still suggesting" = wait up to 30 minutes or reload the window.
- "Turn off completions for Markdown just for me" =
github.copilot.enable.
Five quick revision questions
-
1.Which plans support content exclusions?Show
Copilot Business and Copilot Enterprise.
-
2.What does "*" mean in an organization exclusion?Show
Apply the listed paths to every repository in the organization.
-
3.How long can an exclusion change take to reach an open IDE?Show
Up to 30 minutes.
-
4.Where can you see who changed an exclusion?Show
In the audit log, as a copilot event.
-
5.Which VS Code setting turns completions off for one language?Show
github.copilot.enable.
Official references
Finished this lesson? Tick it off. Your progress is saved in this browser.
Next up: Who Owns Copilot Output, and Its Limits
Lesson done? Make it stick with a quick gameSort It, Match the Pairs, Lightning Round and Who Am I? Earn XP and badges.