Skip to content

Commit 79147b9

Browse files
patrick-knightCopilotsophietheking
authored
Create push-rule-and-prereceive-hooks.md (#55402)
Co-authored-by: Copilot <[email protected]> Co-authored-by: Sophie <[email protected]>
1 parent 74ef933 commit 79147b9

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

content/admin/enforcing-policies/enforcing-policy-with-pre-receive-hooks/about-pre-receive-hooks.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,9 @@ Due to risk of failure and performance impact for all users of your instance, we
4343

4444
> [!NOTE]
4545
> To avoid rejection of a push due to a timeout, all combined pre-receive hooks should run in under five seconds.
46+
47+
{% ifversion ghes > 3.16 %}
48+
49+
{% data reusables.repositories.push-rule-and-prereceive-hooks %}
50+
51+
{% endif %}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
## Choosing between push rules and pre-receive hooks
2+
You can use push rules and pre-receive hooks to control what changes users can push to your repository. Both help you enforce policies, but they work in different ways and are designed for different use cases.
3+
4+
Push rules are a built-in way to enforce common policies across repositories. You can use them to block pushes that don’t meet specific conditions, such as updates to specific files and paths, file size, or file type.
5+
You can manage push rules through the UI or API. As they are a type of repository rulesets, push rules support audit logs, and can be used with evaluate mode to preview changes or bypassed when needed.
6+
7+
Use push rules if you want to easily:
8+
9+
* Enforce standard policies without writing scripts.
10+
* Apply policies consistently across organizations and repositories.
11+
* Manage rules through {% data variables.product.github %}'s UI and APIs.
12+
* Use {% data variables.product.github %} native features like audit logging, bypass lists and rule insights.

0 commit comments

Comments
 (0)