Skip to main content

리포지토리에 대한 규칙 세트 관리

리포지토리에서 기존 규칙 세트를 편집, 모니터링 및 삭제하여 사용자가 특정 분기 및 태그와 상호 작용하는 방법을 변경할 수 있습니다.

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

리포지토리에 대한 읽기 권한이 있는 사용자는 해당 리포지토리의 규칙 세트를 볼 수 있습니다. 리포지토리에 대한 관리자 권한이 있는 사용자 또는 “리포지토리 규칙 편집” 권한이 있는 사용자 지정 역할은(는) 리포지토리에 대한 규칙 세트를 만들고 편집하고 삭제할 수 있습니다.

규칙 세트는 조직의 GitHub Free 및 GitHub Free가 있는 퍼블릭 리포지토리와 GitHub Pro, GitHub Team, GitHub Enterprise Cloud의 퍼블릭 리포지토리 및 프라이빗 리포지토리에서 사용할 수 있습니다. 자세한 내용은 “GitHub의 플랜”를 참조하세요.

푸시 규칙 집합은 내부 및 프라이빗 리포지토리와 푸시 규칙 집합이 사용 설정된 리포지토리의 포크에서 GitHub Team 플랜에 사용할 수 있습니다.

After creating a ruleset, you can still make changes to it. For example, you can add rules to better protect your branches or tags, or you can temporarily disable a ruleset to troubleshoot any unintended effects on the contributor experience for your repository.

You can use the REST and GraphQL APIs to manage rulesets. For more information, see REST API endpoints for rules and Mutations.

Viewing rulesets for a repository

On the "Rulesets" page, anyone with read access to the repository can view the active rulesets targeting a certain branch, tag, or push restriction.

For push rulesets for forked repositories, the "Rulesets" page will indicate that the ruleset is managed by the source repository where the rule is applied.

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

  2. From the file tree view on the left, select the branch dropdown menu, then click View all branches. You can also find the branch dropdown menu at the top of the integrated file editor.

    Screenshot of the file tree view for a repository. A dropdown menu for branches is expanded and outlined in dark orange.

  3. To the left of the branch name, click .

  4. Optionally, to filter the results click the tabs or use the "Search branches" search bar.

  5. Click the name of the ruleset you want to view.

Editing a ruleset

You can edit a ruleset to change parts of the ruleset, such as the name, bypass permissions, or rules. You can also edit a ruleset to change its status, such as if you want to enable or temporarily disable a ruleset.

  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.

    Screenshot of a repository header showing the tabs. The "Settings" tab is highlighted by a dark orange outline.

  3. In the left sidebar, under "Code and automation," click Rules, then click Rulesets.

    Screenshot of the sidebar of the "Settings" page for a repository. The "Rules" sub-menu is expanded, and the "Rulesets" option is outlined in orange.

  4. On the "Rulesets" page, click the name of the ruleset you want to edit.

  5. Change the ruleset as required. For information on the available rules, see Available rules for rulesets.

  6. At the bottom of the page, click Save changes.

Deleting a ruleset

Tip

If you want to temporarily disable a ruleset but do not want to delete it, you can set the ruleset's status to "Disabled." For more information, see Editing a ruleset.

  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.

    Screenshot of a repository header showing the tabs. The "Settings" tab is highlighted by a dark orange outline.

  3. In the left sidebar, under "Code and automation," click Rules, then click Rulesets.

    Screenshot of the sidebar of the "Settings" page for a repository. The "Rules" sub-menu is expanded, and the "Rulesets" option is outlined in orange.

  4. Click the name of the ruleset you want to delete.

  5. To the right of the ruleset's name, select , then click Delete ruleset.

    Screenshot of the page for editing a ruleset. Below a button labeled with three dots, an option labeled "Delete ruleset" is outlined in orange.

Using ruleset history

Note

  • Ruleset history is currently in public preview and subject to change.
  • Only changes made to a ruleset after the public preview release, on October 11, 2023, are included in the ruleset history.

You can view all the changes to a ruleset and revert back to a specific iteration. You can also download a JSON file containing the ruleset's configuration at a specific iteration. The bypass list of a ruleset is excluded from the exported JSON file.

  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.

    Screenshot of a repository header showing the tabs. The "Settings" tab is highlighted by a dark orange outline.

  3. In the left sidebar, under "Code and automation," click Rules, then click Rulesets.

    Screenshot of the sidebar of the "Settings" page for a repository. The "Rules" sub-menu is expanded, and the "Rulesets" option is outlined in orange.

  4. To view the history of changes to the ruleset, select to the right of the ruleset's name, then click History.

    Screenshot of the page for repository rulesets. Below a button labeled with three dots, an option labeled "History" is outlined in orange.

  5. To the right of the specific iteration, select , then click Compare changes, Restore, or Download.

    Screenshot of the page for repository rulesets history. A dropdown menu labeled with three dots is expanded and highlighted with an orange outline.

Importing a ruleset

You can import a ruleset from another repository or organization using a JSON file. This can be useful if you want to apply the same ruleset to multiple repositories or organizations.

  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.

    Screenshot of a repository header showing the tabs. The "Settings" tab is highlighted by a dark orange outline.

  3. In the left sidebar, under "Code and automation," click Rules, then click Rulesets.

    Screenshot of the sidebar of the "Settings" page for a repository. The "Rules" sub-menu is expanded, and the "Rulesets" option is outlined in orange.

  4. Select the New ruleset dropdown, then click Import a ruleset.

    Screenshot of the page for repository rulesets. A dropdown menu labeled "New ruleset" is expanded and the "Import a ruleset" option is highlighted with an orange outline.

  5. Open the exported JSON file.

  6. Review the imported ruleset and click Create.