A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.github.com/en/copilot/how-tos/configure-content-exclusion/exclude-content-from-copilot below:

Excluding content from GitHub Copilot

Learn how to prevent Copilot from accessing certain content.

Configuring content exclusion for your repository

You can use your repository settings to specify content in your repository that GitHub Copilot should ignore.

  1. On GitHub, navigate to the main page of the repository.

  2. Under your repository name, click Settings. If you cannot see the "Settings" tab, select the dropdown menu, then click Settings.

  3. In the "Code & automation" section of the sidebar, click Copilot then click Content exclusion.

    If your repository inherits any exclusions from its parent organization, or from organizations in the same enterprise, you'll see one or more gray boxes at the top of the page, containing details of these exclusions. You cannot edit these settings.

  4. In the box following "Paths to exclude in this repository," enter the paths to files from which Copilot should be excluded.

    Use the format: - "/PATH/TO/DIRECTORY/OR/FILE", with each path on a separate line. You can add comments by starting a line with #.

    Tip

    You can use fnmatch pattern matching notation to specify file paths. Patterns are case insensitive. See File in the ruby-doc.org documentation.

Example of paths specified in the repository settings
- "/src/some-dir/kernel.rs"

Ignore the /src/some-dir/kernel.rs file in this repository.

Ignore files called secrets.json anywhere in this repository.

Ignore all files whose names begin with secret anywhere in this repository.

Ignore files whose names end with .cfg anywhere in this repository.

Ignore all files in or below the /scripts directory of this repository.


- "/src/some-dir/kernel.rs"


- "secrets.json"


- "secret*"


- "*.cfg"


- "/scripts/**"
Configuring content exclusion for your organization

You can use your organization settings to specify files that GitHub Copilot should ignore. The files can be within a Git repository or anywhere on the file system that is not under Git control.

  1. In the upper-right corner of GitHub, click your profile picture, then click Your organizations.

  2. Next to the organization, click Settings.

  3. In the left sidebar, click Copilot then click Content exclusion.

  4. In the box following "Repositories and paths to exclude," enter the details of files from which Copilot should be excluded.

    To exclude files located anywhere (within a Git repository or elsewhere), enter "*": followed by the path to the file, or files, you want to exclude. If you want to specify multiple file path patterns, list each pattern on a separate line.

    To exclude files in a Git repository from Copilot, enter a reference to the repository on one line, followed by paths to locations within the repository, with each path on a separate line. Use the following format, replacing REPOSITORY-REFERENCE with a reference to the repository that contains the files you'd like to exclude:

    REPOSITORY-REFERENCE:
      - "/PATH/TO/DIRECTORY/OR/FILE"
      - "/PATH/TO/DIRECTORY/OR/FILE"
      - ...
    

    Repositories can be referenced using various protocols. You can use any of the following syntaxes for REPOSITORY-REFERENCE and Copilot will match them regardless of how the repository was cloned locally:

    http[s]://host.xz[:port]/path/to/repo.git/
    
    git://host.xz[:port]/path/to/repo.git/
    
    [user@]host.xz:path/to/repo.git/
    
    ssh://[user@]host.xz[:port]/path/to/repo.git/
    

    The user@ and :port parts of the REPOSITORY-REFERENCE are ignored in the calculation of which paths to ignore for a repository.

    For Azure DevOps, you can use the new (dev.azure.com) or old (visualstudio.com) host format when specifying REPOSITORY-REFERENCE, and Copilot will match them regardless of which host was used to clone the repository locally.

    Tip

    You can use fnmatch pattern matching notation to specify file paths. Patterns are case insensitive. See File in the ruby-doc.org documentation.

Example of repositories and paths in organization settings

Ignore all .env files from all file system roots (Git and non-Git). For example, this excludes REPOSITORY-PATH/.env and also /.env. This could also have been written on a single line as:

"*": ["**/.env"]

In the octo-repo repository in this organization:

  - "/src/some-dir/kernel.rs"

Ignore the /src/some-dir/kernel.rs file.

https://github.com/primer/react.git:

In the primer/react repository on GitHub:

Ignore files called secrets.json anywhere in this repository.

Ignore files called temp.rb in or below the /src directory.

git@github.com:*/copilot:

In the copilot repository of any GitHub organization:

Ignore any files in or below the /__tests__ directory.

Ignore any files in the /scripts directory.

git@gitlab.com:gitlab-org/gitlab-runner.git:

In the gitlab-org/gitlab-runner repository on GitLab:

Ignore the /main_test.go file.

Ignore any files with names beginning with server or session anywhere in this repository.

Ignore any files with names ending with .md or .mk anywhere in this repository.

Ignore files directly within directories such as packages or packaged anywhere in this repository.

Ignore files in or below any security directories, anywhere in this repository.






"*":
  - "**/.env"


octo-repo:
  
  - "/src/some-dir/kernel.rs"


https://github.com/primer/react.git:
  
  - "secrets.json"
  
  - "/src/**/temp.rb"


git@github.com:*/copilot:
  
  - "/__tests__/**"
  
  - "/scripts/*"


git@gitlab.com:gitlab-org/gitlab-runner.git:
  
  - "/main_test.go"
  
  - "{server,session}*"
  
  - "*.m[dk]"
  
  - "**/package?/*"
  
  - "**/security/**"
Configuring content exclusion for your enterprise

As an enterprise owner, you can use the enterprise settings to specify files that GitHub Copilot should ignore. The files can be within a Git repository or anywhere on the file system that is not under Git control.

  1. In the top-right corner of GitHub, click your profile picture.
  2. Depending on your environment, click Your enterprise, or click Your enterprises then click the enterprise you want to view.
  3. At the top of the page, click Policies.
  4. In the "Policies" section, click Copilot.
  5. Click the Content exclusion tab.
  6. Use paths to specify which content to exclude. See the previous section, Configuring content exclusion for your organization.

Note

The key difference between setting content exclusion at the enterprise level and the organization level is that rules set at the enterprise level apply to all Copilot users in the enterprise, whereas the rules set by organization owners only apply to users who are assigned a Copilot seat by that organization.

Testing changes to content exclusions

You can use your IDE to confirm that your changes to content exclusions are working as expected.

Propagate content exclusion changes to your IDE

After you add or change content exclusions, it can take up to 30 minutes to take effect in IDEs where the settings are already loaded. If you don't want to wait, you can manually reload the content exclusion settings using the following instructions.

Test your content exclusions

You can verify that content exclusions you have configured are working as expected.

  1. First confirm that content exclusion is working in files that are not subject to content exclusion. To do this:
  2. Open a file that should be excluded and make the same edit. No suggestion should be offered.
  3. To test content exclusion for Copilot Chat:
Further reading

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4