GitHub Copilot suggests code as you type, which can speed up development. However, in some repositories, you may want to disable these suggestions. This could be for proprietary code, sensitive projects, or repositories where AI suggestions are not allowed by policy.
GitHub Copilot does not have a per-repository toggle in its main settings. Instead, you control it through a configuration file in each repository or through your editor settings. The exact method depends on whether you use GitHub Copilot in Visual Studio Code, JetBrains IDEs, or another editor.
This article explains how to disable GitHub Copilot for specific repositories using the .copilotignore file and editor-specific workspace settings. You will also learn how to verify that Copilot is disabled for the intended repository and what to do if the setting does not take effect.
Key Takeaways: Disabling Copilot for a Single Repository
- .copilotignore file in the repository root: Prevents Copilot from suggesting code for files that match the patterns you define.
- VS Code workspace settings: Set
github.copilot.enabletofalseper workspace to disable Copilot completely for that project. - JetBrains IDE project settings: Disable Copilot plugin for the specific project through the IDE settings menu.
How GitHub Copilot Repository Control Works
GitHub Copilot does not offer a built-in toggle to disable suggestions for a single repository. Instead, the control is file-based and editor-based. The most portable method is the .copilotignore file, which works across editors that support it, including VS Code, JetBrains IDEs, and Neovim with the Copilot plugin.
The .copilotignore file uses the same syntax as .gitignore. You list file patterns, and Copilot will not provide suggestions for any file that matches those patterns. This is useful when you want to exclude only certain files or directories, such as a secrets folder or a specific configuration file.
If you want to disable Copilot for the entire repository, you can use a pattern that matches all files. In .copilotignore, the pattern matches every file in the repository. Alternatively, you can use editor-specific workspace settings to disable the Copilot extension entirely for that project.
When to Use .copilotignore vs Workspace Settings
Use .copilotignore when you want to exclude specific files or folders while keeping Copilot active for the rest of the repository. Use workspace settings when you want to disable Copilot completely for the project. The workspace setting overrides the global Copilot setting, so if you have Copilot enabled globally, the workspace setting will turn it off only for that project.
Steps to Disable GitHub Copilot with .copilotignore
- Create the .copilotignore file
In the root directory of the repository, create a new file named.copilotignore. The file must be in the root folder for Copilot to detect it. - Add file patterns to exclude
Open the file and add one pattern per line. To disable Copilot for all files in the repository, add a single line:. To exclude only a specific folder, add a pattern likeconfig/orvendor/. The syntax matches.gitignorerules. - Save and reload the editor
Save the file. In VS Code, you may need to reload the window for the changes to apply. Press Ctrl+Shift+P on Windows or Cmd+Shift+P on Mac, typeReload Window, and press Enter. - Verify Copilot is disabled
Open a file that matches the pattern you added. Start typing. If Copilot is correctly disabled, no inline suggestions will appear. The Copilot status icon in the status bar may still show Copilot as active, but suggestions will not appear for the excluded files.
Steps to Disable Copilot in VS Code Workspace Settings
- Open the workspace settings file
In VS Code, open the command palette with Ctrl+Shift+P on Windows or Cmd+Shift+P on Mac. TypePreferences: Open Workspace Settings (JSON)and press Enter. This opens the.vscode/settings.jsonfile for the current workspace. - Add the Copilot disable setting
Add the following JSON entry to the settings file:"github.copilot.enable": {"": false}
This disables Copilot for all languages in this workspace. If you only want to disable it for a specific language, replacewith the language identifier, such as"python". - Save the file
Press Ctrl+S on Windows or Cmd+S on Mac to save. The setting takes effect immediately. No editor reload is required. - Confirm Copilot is off
Open any file in the workspace. The Copilot status icon in the bottom status bar should show a circle with a slash, indicating Copilot is disabled for this workspace. If the icon still shows Copilot as active, check that the setting is in the correct.vscode/settings.jsonfile and not in the global user settings.
Steps to Disable Copilot in JetBrains IDEs
- Open project settings
In IntelliJ IDEA, PyCharm, or other JetBrains IDE, click File > Settings on Windows or IntelliJ IDEA > Preferences on Mac. This opens the settings dialog for the current project. - Navigate to Copilot settings
In the left panel, expand Tools and select GitHub Copilot. The settings page shows options for enabling Copilot and configuring its behavior. - Disable Copilot for the project
Uncheck the box labeled Enable GitHub Copilot. This disables Copilot only for the current project. Other projects will still use the global setting. - Apply and close
Click Apply then OK. Copilot will no longer provide suggestions in this project. To re-enable it later, return to the same settings and check the box.
If Copilot Still Shows Suggestions After Disabling
Copilot suggests code despite .copilotignore
If you added a .copilotignore file but Copilot still suggests code, check that the file is named exactly .copilotignore with no file extension. The file must be in the root of the repository, not in a subfolder. Also confirm that the pattern syntax is correct. For example, matches all files, but txt matches only text files. If you use a pattern like src/, it excludes only the directory itself, not its contents. Use src/ to exclude all files inside the src directory.
VS Code workspace setting does not take effect
If the workspace setting github.copilot.enable does not disable Copilot, verify that the setting is in the correct file. The setting must be in .vscode/settings.json inside your project folder. If you placed it in your global settings.json at %APPDATA%/Code/User/settings.json on Windows or ~/Library/Application Support/Code/User/settings.json on Mac, it will apply to all workspaces. Move the setting to the workspace file instead.
JetBrains IDE still shows Copilot suggestions
In JetBrains IDEs, the project-level setting overrides the global setting only if you explicitly change it in the project settings. If you see Copilot suggestions after disabling, open the settings again and confirm that the checkbox is unchecked. Also ensure that you clicked Apply before closing the dialog. If the setting reverts, the project may have a shared settings file that enforces the global preference. Check File > Settings > Tools > GitHub Copilot and look for a lock icon. If the lock is closed, the setting is managed by the project and cannot be changed locally.
| Item | .copilotignore Method | Workspace Settings Method |
|---|---|---|
| Scope | Per file or folder pattern | Entire workspace or project |
| File needed | .copilotignore in repo root | .vscode/settings.json or IDE project settings |
| Editor support | VS Code, JetBrains, Neovim | VS Code, JetBrains IDEs |
| Version control | File can be committed to repo | Settings file can be committed to repo |
| Granularity | Fine-grained per file type or folder | All-or-nothing per project |
| Overrides global setting | Yes | Yes |
You can now disable GitHub Copilot for specific repositories using the .copilotignore file or workspace settings. Choose the method that matches your workflow. If you use multiple editors, the .copilotignore file is the most portable option because it works across editors that support the Copilot extension. For a complete disable in VS Code, the workspace setting is simpler and does not require a separate file. Try adding the .copilotignore file to a test repository first to confirm the pattern syntax works as expected before applying it to production projects.