Skip to main content

About content exclusions for GitHub Copilot

Learn how content exclusions for GitHub Copilot work.





从 GitHub Copilot 中排除的内容目前为公开 Beta 版,可能会有变动。

You can configure GitHub Copilot to ignore certain files by excluding specific paths to content in the settings for your repository or organization.

When you specify content exclusions, there are up to three effects depending on the level of support for your IDE:

  • Code completion will not be available in the affected files.
  • The content in affected files will not inform code completion suggestions in other files.
  • The content in affected files will not inform GitHub Copilot Chat's responses.

添加或更改内容排除项后,可能需要长达 30 分钟才能在已加载设置的 IDE 中生效。 可以将更改应用于自己的 IDE,强制其重新加载内容排除设置。 See "Testing changes to content exclusions in your IDE."

Availability of content exclusions

ToolCode completion supportCopilot Chat support
Visual Studio
Visual Studio Code
JetBrains IDEs
Vim/NeovimNot applicable
Azure Data StudioNot applicable
GitHub.comNot applicable

Limitations of content exclusions

  • 在 Visual Studio Code 中的 Copilot Chat 中,当在问题中使用 @github 聊天参与者时,不会应用内容排除项。
  • 如果 IDE 在未排除的文件中提供了 Copilot 中的语义信息,则可能会使用该信息。 此类内容的示例包括代码中使用的符号的类型信息和悬停定义。

What can you exclude?

When you specify content exclusion in the settings for a repository, you can only exclude files in that repository.

When you specify content exclusion in the settings for an organization, you can exclude files in any Git-based repository hosted on, or anywhere that can be accessed using any of the following syntaxes:





Who is affected by a content exclusion setting?


  • 作为 GitHub Copilot Business 或 GitHub Copilot Enterprise 订阅的一部分,他们已被授予一个席位
  • 他们是配置了内容排除的同一的成员

任何其他可以访问指定文件的人仍将看到引用指定文件的代码完成建议和 GitHub Copilot Chat 响应。

You can't specify content exclusions in the settings for an enterprise. However, all content exclusions defined in organization or repository settings apply to all members of the enterprise who have been granted a Copilot seat as part of a Copilot Business or Copilot Enterprise subscription.

This means, for example, that if you are an admin of an organization that belongs to Enterprise X, you can set up an exclusion for files in any Git-based repositories, hosted on GitHub or elsewhere, and the exclusion will apply to anyone who gets their Copilot Business or Copilot Enterprise license from any organization in Enterprise X.


To more easily track content exclusions, create exclusions in the settings of the repository containing the affected files, or in the settings of the organization that owns the repository.

Data sent to GitHub

After you configure content exclusion, the client (for example, the Copilot extension for VS Code) sends the current repository URL to the GitHub server so that the server can return the correct policy to the client. These URLs are not logged anywhere.

Next steps

To set up content exclusions in your repository or organization, see "Configuring content exclusions for GitHub Copilot."