GitHub Copilot is an AI coding assistant that suggests code and answers questions inside your editor.
This guide is for developers, team leads and admins starting with Copilot. It covers the settings that control what Copilot sees, what it suggests and how your data is used.
This is an independent guide from NHI Mgmt Group, based on GitHub's public documentation as of December 2026. It is not sponsored or reviewed by GitHub. Product features change, so confirm settings against GitHub's current documentation.
In short
- Copilot sends code near your cursor and from open tabs to a language model to make suggestions.
- Business and Enterprise plans can set content exclusion, so Copilot ignores chosen files.
- A setting can block suggestions that match public code, or show where the match came from.
- You stay responsible for the code you accept. Review it, and never put secrets in it.
What you will learn
- Explain what Copilot sends to the model and why that matters.
- Find the settings for public code matches and data use.
- Describe what content exclusion does and where it stops.
- Build simple habits that keep secrets out of prompts and code.
- Ghost text (suggestion)
- code Copilot offers as you type, which you can accept or ignore.
- Hidden file list (content exclusion)
- a set of file paths an admin tells Copilot to ignore.
- Password in code (hardcoded secret)
- a password, key or token typed straight into a file.
What is GitHub Copilot?
Think of a fast helper reading over your shoulder. It sees what is on your desk and offers the next line. It is often right, but it does not know your rules.
Copilot works the same way in your code editor. Code near your cursor and context from open tabs are sent to a language model, which returns a suggestion [4].
GitHub says suggestions can look correct but may not always be secure. It advises you to review and test generated code, and to avoid hard-coded passwords [4].
Where the comparison stops working: a human helper forgets what they saw. With Copilot, what it can see depends on settings your admins and you control.
For the wider topic, see AI Coding Assistants for Beginners.
Why does it matter?
Copilot can make work faster. A few settings and habits decide whether code and secrets stay where they belong.
If you write code
What could happen: you accept a suggestion with a password typed into it, and it reaches your repository.
Check this: read every suggestion before you accept it, and keep secrets in a vault or secret store.
If you run a GitHub organisation
What could happen: files with keys or private customer logic are shown to Copilot when they should not be.
Check this: set content exclusion for those paths and review your Copilot policies.
If you use Copilot on a personal plan
What could happen: you have not checked whether your data may be used for model training.
Check this: open your Copilot settings and set the training option the way you want it. It is on by default for personal plans.
What does it look like?
Here is a made-up content exclusion list an admin might set for one repository. Real paths will differ.
Example only. All values are made up.
Repository: EXAMPLE-org/EXAMPLE-payments (1) Paths to exclude in this repository: - "/config/secrets.FAKE.json" (2) - "/deploy/**" (3) - "*.pem" (4) Owner: FAKE-team-platform (5)
- The repository the rules apply to.
- In a real file, this line would contain the path of a settings file that should never be shown to Copilot.
- A whole folder of deployment files.
- Any certificate or key file, wherever it sits.
- The team that keeps this list up to date.
Why this is risky: a secret in a file is still a secret in a file. Hiding it from Copilot does not stop people or other tools from reading it.
The safer way: move secrets out of the repository, and use content exclusion as an extra layer for files Copilot should not use.
How does it work?
- You type or ask. Copilot gathers code near your cursor and context from open tabs [4].
- Exclusions are applied. Excluded files get no inline suggestions, and Chat does not use them in answers [1].
- The model suggests. The context goes to a language model, which returns code or an answer [4].
- Public code check. A suggestion plus about 150 characters of nearby code is compared with an index of public GitHub code. Matches are blocked or shown with a reference, depending on the setting [3].
- You decide. You accept, change or reject it. GitHub says you assume the risks of code you use [4].

The main settings
- Content exclusion: set by repository admins, organisation owners or enterprise owners on Copilot Business and Copilot Enterprise [1].
- Suggestions matching public code: Allow or Block. On personal plans you set it yourself. With a seat from an organisation, its setting applies [5].
- Data for model training: since 24 April 2026, GitHub may use Free, Pro, Pro+ and Max interactions to train its models. This applies unless you turn the setting "Allow GitHub to use my data for AI model training" off[5]. GitHub says Business and Enterprise data is not used for training [5].
- Feature and model policies: organisation owners choose which features and extra models are on. Enterprise settings take precedence [2].
A worked example
This story is made up to show the idea.
Petra Engel leads a small team at a firm that builds booking software. The firm has just bought Copilot Business for her developers.
Before switching it on, Petra meets Jonah Delmar, who owns the firm's GitHub organisation. They list the repositories with sensitive files. One has a deployment folder and a few certificate files.
Jonah sets content exclusion for those paths. He also sets the public code option to Block, and turns off preview features for now.
In the first week, a developer asks Copilot to write a database connection. The suggestion has a placeholder password typed into the code. The developer spots it in review and swaps it for a call to the firm's secret store.
Petra adds two rules to the team's review checklist. No secrets in code, and every Copilot suggestion is read before it is accepted.
A month later, a developer finds that one old script still reads a key from the excluded folder. Jonah moves that key into the secret store. He keeps the exclusion as an extra layer.
Petra learned that Copilot settings help. Moving secrets out of code and reviewing suggestions do most of the work.
Myths and mistakes
| What people think | What is true |
|---|---|
| Copilot's code is safe because it comes from a smart tool. | GitHub says suggestions may not always be secure, so review and test them.[4] |
| Content exclusion locks the file. | GitHub says it is not a substitute for operating system permissions or other access controls.[1] |
| A new exclusion works straight away everywhere. | It can take up to 30 minutes in an editor that already loaded settings. Reloading applies it sooner.[1] |
| All Copilot plans handle data the same way. | The training setting applies to personal plans. GitHub says Business and Enterprise data is not used for training.[5] |
| I can change every setting on my work account. | With a seat from an organisation, its settings apply, and enterprise settings take precedence.[5][2] |
What can I do this week?
- Open your Copilot settings and check the public code and training options.
- Search one repository for passwords or keys, and move any you find to a secret store.
- If you are an admin, list files Copilot should not use and set content exclusion.
- Add "read every Copilot suggestion" to your team's review checklist.
Checklist
- I read every suggestion before I accept it.
- No passwords, keys or tokens are typed into code or prompts.
- Secrets live in a vault or secret store, not in the repository.
- Content exclusion covers files Copilot should not use.
- Normal file permissions still protect sensitive files.
- The public code setting is set on purpose, not left unchecked.
- I know which plan I am on and how it treats my data.
Common questions
Does Copilot see my whole repository?
For inline suggestions, GitHub says Copilot sends code near your cursor and context from open tabs to the model. Content exclusion keeps chosen files out of what Copilot uses.[4][1]
Is my code used to train models?
It depends on your plan. On Free, Pro, Pro+ and Max, training use is on unless you turn it off in your settings. GitHub says Business and Enterprise data is not used for training. Check your settings page to be sure.[5]
What does blocking public code matches do?
Copilot compares a suggestion and about 150 characters of nearby code with an index of public GitHub code. With Block set, close matches are hidden. With Allow, a reference may show where the match came from.[3]
Does content exclusion work with Copilot agents?
Yes, with care. In an editor, the CLI or the Copilot app, it blocks access through Copilot tools and checks file paths in commands. GitHub says it might not detect indirect access, so keep normal permissions too.[1]
What if a secret ends up in a suggestion or commit?
Treat it as leaked. Change the secret at its source first, then remove it from the code. Deleting the line alone is not enough, because copies can stay in history and elsewhere.
Where next?
Ready for the detail? Read the practitioner guide: What Is GitHub Copilot? Plans, Agent Mode, Models and History. It covers plans, agent mode and models in more depth.
Also useful:
- GitHub Copilot Security Guide
- AI Coding Assistants for Beginners
- GitHub Security for Beginners
- Leaked Secret Response for Beginners
Related NHI Mgmt Group resources: Secrets Management for Beginners, Environment Variables and .env Files for Beginners and AI Training Opt-Outs for Beginners.
Key terms
- GitHub Copilot
- An AI coding assistant from GitHub that suggests code and answers questions inside the editor and on GitHub.
- AI coding assistant
- Software that helps write, change, debug or explain code using suggestions from an AI model.
- Large language model
- An AI system trained on large amounts of text that generates and transforms language based on patterns.
- Hardcoded secret
- A credential written directly into source code, scripts or config files.
- Secrets scanning
- Automated checks of code, pipelines and cloud settings that look for exposed secrets such as keys and tokens.
- Code review
- A person checking a proposed code change before it is accepted.
Sources and further reading
- GitHub, "Excluding content from GitHub Copilot", GitHub Docs. https://docs.github.com/en/copilot/how-tos/configure-content-exclusion/exclude-content-from-copilot (accessed 1 Dec 2026).
- GitHub, "Managing policies and features for GitHub Copilot in your organization", GitHub Docs. https://docs.github.com/en/copilot/how-tos/administer-copilot/manage-for-organization/manage-policies (accessed 1 Dec 2026).
- GitHub, "GitHub Copilot code referencing", GitHub Docs. https://docs.github.com/en/copilot/concepts/completions/code-referencing (accessed 1 Dec 2026).
- GitHub, "Responsible use of GitHub Copilot inline suggestions", GitHub Docs. https://docs.github.com/en/copilot/responsible-use/copilot-code-completion (accessed 1 Dec 2026).
- GitHub, "Managing GitHub Copilot policies as an individual subscriber", GitHub Docs. https://docs.github.com/en/copilot/how-tos/manage-your-account/manage-policies (accessed 1 Dec 2026).