About managing rulesets for an organization
After creating a ruleset at the organization level, you can make changes to the ruleset to alter how people can interact with the targeted repositories. For example, you can add rules to better protect the branches or tags in those repositories. Organizational rulesets that apply to branches of a repository will no longer allow the repository administrator to rename branches of the targeted repository or change the default branch to another branch. Repository administrators may create and delete branches so long as they have the appropriate permissions.
You can use the REST and GraphQL APIs to manage rulesets. For more information, see REST API endpoints for rules and Mutations.
Note
Anyone with read access to a repository can view the active rulesets operating on that repository.
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.
-
In the upper-right corner of GitHub, click your profile picture, then click Your organizations.
-
Next to the organization, click Settings.
-
In the left sidebar, in the "Code, planning, and automation" section, click Repository, then click Rulesets.
-
On the "Rulesets" page, click the name of the ruleset you want to edit.
-
Change the ruleset as required. For information on the available rules, see Available rules for rulesets.
-
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.
-
In the upper-right corner of GitHub, click your profile picture, then click Your organizations.
-
Next to the organization, click Settings.
-
In the left sidebar, in the "Code, planning, and automation" section, click Repository, then click Rulesets.
-
Click the name of the ruleset you want to delete.
-
To the right of the ruleset's name, select , then click Delete ruleset.
Using ruleset history
Note
Ruleset history lists events triggered by changes that affect your rulesets within the last 180 days.
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.
-
In the upper-right corner of GitHub, click your profile picture, then click Your organizations.
-
Next to the organization, click Settings.
-
In the left sidebar, in the "Code, planning, and automation" section, click Repository, then click Rulesets.
-
To view the history of changes to the ruleset, select to the right of the ruleset's name, then click History.
-
To the right of the specific iteration, select , then click Compare changes, Restore, or Download.
Importing a ruleset
You can import a ruleset from another repository or organization using the exported JSON file from the previous section. This can be useful if you want to apply the same ruleset to multiple repositories or organizations.
-
In the upper-right corner of GitHub, click your profile picture, then click Your organizations.
-
Next to the organization, click Settings.
-
In the left sidebar, in the "Code, planning, and automation" section, click Repository, then click Rulesets.
-
Select the New ruleset dropdown, then click Import a ruleset.
-
Open the exported JSON file.
-
Review the imported ruleset and click Create.