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
创建或编辑规则集时,可以使用强制状态来配置规则集的强制实施方式。
可以为规则集选择以下任何强制状态。
- Active:规则集创建后便会强制实施。****
- Evaluate:不会强制执行规则集,但你能够在“Rule Insights”页上监控哪些操作会或不会违反规则。****
- Disabled:不会强制实施或评估规则集。****
使用“评估”模式是在不强制执行规则集的情况下测试规则集的绝佳选择。 可以使用“规则见解”页查看贡献是否违反了规则。 有关详细信息,请参阅“管理存储库的规则集”。
Creating a branch or tag ruleset
-
在 GitHub 的右上角,单击你的个人资料图片。
-
根据环境,单击“你的企业”,或单击“你的企业”,然后单击要查看的企业********。
-
在页面顶部,单击“ Policies”。
-
Under "Policies", click Code.
-
单击“添加规则集”。****
-
若要创建面向分支的规则集,请单击“新建分支规则集”。 或者,若要创建针对标签的规则集,请单击“新建标签规则集”****。
-
在“规则集名称”下,键入规则集的名称。
-
(可选)若要更改默认强制实施状态,请单击 “Disabled”,并选择强制实施状态****。 有关强制状态的详细信息,请参阅关于规则集。
For a more detailed explanation of the available options, see 使用规则集在企业中强制实施代码治理.
Next steps
Learn how to monitor and audit activity in your enterprise. See Using the audit log for your enterprise.