You can create rulesets to control how users can interact with code in repositories across your enterprise. You can:
- Create a branch or tag ruleset to control things like who can push commits to a certain branch, how commits must be formatted, or who can delete or rename a tag.
- Create a push ruleset to block pushes to a private or internal repository and the repository's entire fork network. Push rulesets allow you to block pushes based on file extensions, file path lengths, file and folder paths, and file sizes.
Using ruleset enforcement statuses
While creating or editing your ruleset, you can use enforcement statuses to configure how your ruleset will be enforced.
You can select any of the following enforcement statuses for your ruleset.
- Active: your ruleset will be enforced upon creation.
- Evaluate: your ruleset will not be enforced, but you will be able to monitor which actions would or would not violate rules on the "Rule Insights" page.
- Disabled: your ruleset will not be enforced or evaluated.
Using "Evaluate" mode is a great option for testing your ruleset without enforcing it. You can use the "Rule Insights" page to see if the contribution would have violated the rule.
Creating a branch or tag ruleset
-
In the top-right corner of GitHub, click your profile picture.
-
Depending on your environment, click Enterprise, or click Enterprises then click the enterprise you want to view.
-
At the top of the page, click Policies.
-
Under "Policies", click Code.
-
Click New ruleset.
-
To create a ruleset targeting branches, click New branch ruleset. Alternatively, to create a ruleset targeting tags, click New tag ruleset.
-
Under "Ruleset name," type a name for the ruleset.
-
Optionally, to change the default enforcement status, click Disabled and select an enforcement status.
For a more detailed explanation of the available options, see Enforcing code governance in your enterprise with rulesets.
Next steps
Learn how to monitor and audit activity in your enterprise. See Using the audit log for your enterprise.