Skip to main content

GitHub Copilot에서 콘텐츠 제외

Copilot이(가) 특정 콘텐츠에 액세스하지 못하도록 방지하는 방법을 알아봅니다.

누가 이 기능을 사용할 수 있나요?

Repository administrators, organization owners, and enterprise owners can manage content exclusion settings. People with the "Maintain" role for a repository can view, but not edit, content exclusion settings for that repository.

Copilot Business 또는 Copilot Enterprise 플랜을 사용하는 조직입니다.

리포지토리의 콘텐츠 제외 구성하기

리포지토리 설정을 사용하여 GitHub Copilot에서 무시해야 하는 콘텐츠를 리포지토리에 지정할 수 있습니다.

  1. GitHub에서 리포지토리의 기본 페이지로 이동합니다.

  2. 리포지토리 이름 아래에서 Settings를 클릭합니다. "설정" 탭이 표시되지 않으면 드롭다운 메뉴를 선택한 다음 설정을 클릭합니다.

    탭을 보여 주는 리포지토리 헤더의 스크린샷. "설정" 탭이 진한 주황색 윤곽선으로 강조 표시됩니다.

  3. 사이드바의 "Code & automation" 섹션에서 Copilot 을 클릭한 다음, Content exclusion을 클릭합니다.

    리포지토리가 부모 조직 또는 같은 엔터프라이즈 내의 조직에서 제외 항목을 상속받은 경우, 해당 제외에 대한 세부 정보를 포함하는 페이지 맨 위에 하나 이상의 회색 상자가 표시됩니다. 이러한 설정은 편집할 수 없습니다.

  4. "이 리포지토리에서 제외할 경로" 상자에서 Copilot을(를) 제외해야 하는 파일의 경로를 입력합니다.

    형식 - "/PATH/TO/DIRECTORY/OR/FILE"을(를) 사용합니다. 각 경로는 별도의 줄에 있습니다. #(으)로 줄을 시작하여 메모를 추가할 수 있습니다.

    fnmatch 패턴 일치 표기법을 사용하여 파일 경로를 지정할 수 있습니다. 패턴은 대/소문자를 구분하지 않습니다. ruby-doc.org 설명서의파일을 참조하세요.

리포지토리 설정에 지정된 경로 예시

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

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

- "secrets.json"

Ignore files called secrets.json anywhere in this repository.

- "secret*"

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

- "*.cfg"

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

- "/scripts/**"

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

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

# Ignore files called `secrets.json` anywhere in this repository.
- "secrets.json"

# Ignore all files whose names begin with `secret` anywhere in this repository.
- "secret*"

# Ignore files whose names end with `.cfg` anywhere in this repository.
- "*.cfg"

# Ignore all files in or below the `/scripts` directory of this repository.
- "/scripts/**"

조직의 콘텐츠 제외 구성하기

조직 설정을 사용하여 GitHub Copilot이(가) 무시해야 하는 콘텐츠를 지정할 수 있습니다. 파일은 Git 리포지토리 내에 있거나 Git 제어에 속하지 않는 파일 시스템의 어느 곳에나 있을 수 있습니다.

  1. GitHub의 오른쪽 위 모서리에서 프로필 사진을 클릭한 다음, Your organizations를 클릭합니다.

  2. 조직 옆에 있는 설정을 클릭합니다.

  3. 왼쪽 사이드바에서 Copilot 을 클릭한 다음, Content exclusion을 차례로 클릭합니다.

  4. "제외할 리포지토리 및 경로" 상자에서 Copilot을(를) 제외해야 하는 파일 위치에 대한 세부 정보를 입력합니다.

    Git 리포지토리 내 또는 다른 위치에 있는 파일을 제외하려면 "*":을(를) 입력한 후 파일 경로 또는 제외하려는 파일을 입력합니다. 여러 파일 경로 패턴을 지정하려면 각 패턴을 별도의 줄에 나열합니다.

    Git 저장소의 파일을 에서 제외하려면 한 줄에 저장소에 대한 참조를 입력한 다음 저장소 내 위치에 대한 경로를 입력하고 각 경로를 별도의 줄에 입력합니다. 다음 형식을 사용하여 제외하려는 파일이 포함된 리포지토리에 대한 참조로 REPOSITORY-REFERENCE를 바꿉니다.

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

    리포지토리는 다양한 프로토콜을 사용하여 참조할 수 있습니다. 리포지토리가 로컬로 복제된 방식에 관계없이 REPOSITORY-REFERENCE 및 Copilot에 다음 구문 중 하나를 사용할 수 있습니다:

    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/
    

    리포지토리에 대해 무시할 경로의 계산에서 REPOSITORY-REFERENCEuser@:port 경로는 무시됩니다.

    Azure DevOps의 경우 REPOSITORY-REFERENCE를 지정할 때 새 호스트(dev.azure.com) 또는 이전 호스트(visualstudio.com) 중 하나를 사용할 수 있으며, Copilot은(는) 리포지토리를 로컬로 복제하는 데 사용된 호스트와 관계없이 두 호스트를 일치시킵니다.

    fnmatch 패턴 일치 표기법을 사용하여 파일 경로를 지정할 수 있습니다. 패턴은 대/소문자를 구분하지 않습니다. ruby-doc.org 설명서의파일을 참조하세요.

조직 설정에서 리포지토리 및 경로 예시

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

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"]

octo-repo:

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:

  - "secrets.json"

Ignore files called secrets.json anywhere in this repository.

  - "/src/**/temp.rb"

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

git@github.com:*/copilot:

In the copilot repository of any GitHub organization:

  - "/__tests__/**"

Ignore any files in or below the /__tests__ directory.

  - "/scripts/*"

Ignore any files in the /scripts directory.

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

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

  - "/main_test.go"

Ignore the /main_test.go file.

  - "{server,session}*"

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

  - "*.m[dk]"

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

  - "**/package?/*"

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

  - "**/security/**"

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

# 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"]
"*":
  - "**/.env"

# In the `octo-repo` repository in this organization:
octo-repo:
  # Ignore the `/src/some-dir/kernel.rs` file.
  - "/src/some-dir/kernel.rs"

# In the `primer/react` repository on GitHub:
https://github.com/primer/react.git:
  # Ignore files called `secrets.json` anywhere in this repository.
  - "secrets.json"
  # Ignore files called `temp.rb` in or below the `/src` directory.
  - "/src/**/temp.rb"

# In the `copilot` repository of any GitHub organization:
git@github.com:*/copilot:
  # Ignore any files in or below the `/__tests__` directory.
  - "/__tests__/**"
  # Ignore any files in the `/scripts` directory.
  - "/scripts/*"

# In the `gitlab-org/gitlab-runner` repository on GitLab:
git@gitlab.com:gitlab-org/gitlab-runner.git:
  # Ignore the `/main_test.go` file.
  - "/main_test.go"
  # Ignore any files with names beginning with `server` or `session` anywhere in this repository.
  - "{server,session}*"
  # Ignore any files with names ending with `.md` or `.mk` anywhere in this repository.
  - "*.m[dk]"
  # Ignore files directly within directories such as `packages` or `packaged` anywhere in this repository.
  - "**/package?/*"
  # Ignore files in or below any `security` directories, anywhere in this repository.
  - "**/security/**"

엔터프라이즈의 콘텐츠 제외 구성하기

엔터프라이즈 소유자는 엔터프라이즈 설정을 사용하여 GitHub Copilot에서 무시해야 하는 파일을 지정할 수 있습니다. 파일은 Git 리포지토리 내에 있거나 Git 제어에 속하지 않는 파일 시스템의 어느 곳에나 있을 수 있습니다.

  1. GitHub의 오른쪽 위 모서리에서 프로필 사진을 클릭합니다.
  2. 사용자 환경에 따라 사용자 엔터프라이즈를 클릭하거나 사용자 엔터프라이즈를 클릭한 다음, 보고 싶은 엔터프라이즈를 클릭합니다.
  3. 페이지 상단에서 정책을 클릭합니다.{ %else %}페이지의 왼쪽에 있는 엔터프라이즈 계정 사이드바에서 정책을 클릭합니다.
  4. "Policies" 섹션에서 Copilot 를 클릭하세요.
  5. 페이지 상단에 Content exclusion 탭이 보이면 클릭하세요. 그렇지 않은 경우, "Content exclusion" 옆에 있는 아이콘을 클릭하세요.
  6. 경로를 사용하여 제외할 콘텐츠를 지정합니다. 이전 섹션인 Configuring content exclusion for your organization을 참조하세요.

참고 항목

엔터프라이즈 수준과 조직 수준에서 콘텐츠 제외를 설정하는 것의 주요 차이점은 엔터프라이즈 수준에서 설정한 규칙은 엔터프라이즈의 모든 Copilot 사용자에게 적용되는 반면, 조직 소유자가 설정한 규칙은 해당 조직에서 Copilot 시트를 할당한 사용자에게만 적용된다는 것입니다.

콘텐츠 제외 변경 내용 테스트

IDE를 사용하여 콘텐츠 제외에 대한 변경 내용이 예상대로 작동하는지 확인할 수 있습니다.

IDE에 콘텐츠 제외 변경 내용 전파

콘텐츠 제외를 추가하거나 변경한 후 설정이 이미 로드된 IDE에서 적용되려면 최대 30분이 걸릴 수 있습니다. 기다리지 않으려면 다음 지침을 사용하여 콘텐츠 제외 설정을 수동으로 다시 로드할 수 있습니다.

  • JetBrains IDE 및 Visual Studio 의 경우 애플리케이션을 닫았다가 다시 열어 콘텐츠 제외 설정을 다시 로드합니다.
  • Visual Studio Code 의 경우 다음 단계를 사용하여 콘텐츠 제외 설정을 다시 로드합니다.
    1. 명령 팔레트에 액세스합니다. 예를 들어, Shift+Command+P(Mac)/Ctrl+Shift+P(Windows/Linux)를 누릅니다.
    2. 유형: reload.
    3. 개발자: 창 다시 로드를 선택합니다.
  • Vim/Neovim의 경우 파일을 열 때마다 GitHub에서 콘텐츠 제외가 자동으로 페치됩니다.

콘텐츠 제외 테스트

구성한 콘텐츠 제외가 예상대로 작동하는지 확인할 수 있습니다.

  1. 먼저 콘텐츠 제외의 적용되지 않는 파일에서 콘텐츠 제외가 작동하는지 확인합니다. 방법:
    • IDE에서 콘텐츠 제외의 대상이 아닌 파일을 엽니다.
    • 일반적으로 코드 완성 제안을 생성하는 편집을 만듭니다. 제안 사항이 제공되어야 합니다.
  2. 제외해야 하는 파일을 열고 동일한 편집을 수행합니다. 아무런 제안도 제공해서는 안됩니다.
  3. Copilot Chat에서 콘텐츠 제외를 테스트하려면:
    • IDE에서 Copilot Chat 패널을 엽니다.

    • 제외해야 할 파일을 열고 편집기에 열려 있는 다른 파일을 모두 닫습니다.

    • 열려 있는 파일이 컨텍스트 파일로 프롬프트에 연결되어 있는지 확인합니다.

    • 프롬프트 explain this file를 입력합니다.

      해당 파일이 제외되면 Copilot Chat은 파일을 사용하여 응답을 생성할 수 없습니다. 해당 파일은 Copilot의 응답에 참조로 나열되지 않습니다.

추가 참고 자료