Skip to content

Commit 62072be

Browse files
sophiethekinggithub-actionslucascostimattpollard
authored
[2022-08-mid]: 🎁 Repo Policies: Admins can block pushes that destructively use --mirror - [GA] (#30141)
Co-authored-by: github-actions <[email protected]> Co-authored-by: Lucas Costi <[email protected]> Co-authored-by: Matt Pollard <[email protected]>
1 parent 62c44b0 commit 62072be

File tree

5 files changed

+45
-0
lines changed

5 files changed

+45
-0
lines changed
35.6 KB
Loading
42.1 KB
Loading

content/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ children:
1414
- /managing-the-forking-policy-for-your-repository
1515
- /managing-pull-request-reviews-in-your-repository
1616
- /managing-the-commit-signoff-policy-for-your-repository
17+
- /managing-the-push-policy-for-your-repository
1718
- /managing-git-lfs-objects-in-archives-of-your-repository
1819
- /enabling-anonymous-git-read-access-for-a-repository
1920
- /about-email-notifications-for-pushes-to-your-repository
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: Managing the push policy for your repository
3+
intro: You can limit how many branches and tags can be updated in a single push.
4+
versions:
5+
feature: limit-branches-tags-in-push
6+
permissions: People with admin permissions for a repository can manage the push policy for the repository.
7+
topics:
8+
- Repositories
9+
shortTitle: Manage the push policy
10+
---
11+
12+
## About the push policy
13+
14+
{% note %}
15+
16+
**Note:** The push policy is currently in beta and subject to change.
17+
18+
{% endnote %}
19+
20+
By default, there is no limit to the number of branches and tags that can be updated in a single push.
21+
22+
You can limit the number of branches and tags that can be updated in a single push to block potentially destructive pushes. This can prevent or limit the loss of data.
23+
24+
The push policy also blocks the Git command: `git push --mirror`. This is a potentially destructive command for making the remote exactly match the local clone. When run by accident, it can cause many force-pushes and branch deletions on the remote without any warning.
25+
26+
## Limiting how many branches and tags can be updated in a single push
27+
28+
{% data reusables.repositories.navigate-to-repo %}
29+
{% data reusables.repositories.sidebar-settings %}
30+
3. Under "Pushes", select **Limit how many branches and tags can be updated in a single push**.
31+
32+
![Screenshot of the limit how many branches and tags can be updated in a single push option](/assets/images/help/repository/limit-branches-and-tags-single-push.png)
33+
4. Enter the number of branches and tags you want to limit in a single push. Lower numbers are more restrictive of which pushes are allowed, and higher numbers are less restrictive but have more potential for being destructive.
34+
35+
We recommend the default maximum of `5` branch or tag updates allowed in one push. The minimum value is `2`, because Git requires two branch updates to rename a branch in a single push: *delete branch* and *create branch*.
36+
37+
![Screenshot of the field where you enter the number of branches and tags you want to limit](/assets/images/help/repository/set-limit-branch-tags-single-push.png)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Reference: #6046
2+
# Repo Policies: Admins can block pushes that destructively use --mirror - [GA]
3+
versions:
4+
fpt: '*'
5+
ghec: '*'
6+
ghes: '>=3.7'
7+
ghae: '>=3.7'

0 commit comments

Comments
 (0)