Merge pull request #27506 from github/davidstaheli/restrict-create-branch
Branch protection rule: allow restricting creation of matching branches
This commit is contained in:
BIN
assets/images/help/repository/restrict-branch-create.png
Normal file
BIN
assets/images/help/repository/restrict-branch-create.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 22 KiB |
@@ -161,9 +161,13 @@ By default, protected branch rules do not apply to people with admin permissions
|
||||
You can enable branch restrictions if your repository is owned by an organization using {% data variables.product.prodname_team %} or {% data variables.product.prodname_ghe_cloud %}.
|
||||
{% endif %}
|
||||
|
||||
When you enable branch restrictions, only users, teams, or apps that have been given permission can push to the protected branch. You can view and edit the users, teams, or apps with push access to a protected branch in the protected branch's settings. When status checks are required, the people, teams, and apps that have permission to push to a protected branch will still be prevented from merging if the required checks fail. People, teams, and apps that have permission to push to a protected branch will still need to create a pull request when pull requests are required.
|
||||
When you enable branch restrictions, only users, teams, or apps that have been given permission can push to the protected branch. You can view and edit the users, teams, or apps with push access to a protected branch in the protected branch's settings. When status checks are required, the people, teams, and apps that have permission to push to a protected branch will still be prevented from merging into the branch when the required checks fail. People, teams, and apps that have permission to push to a protected branch will still need to create a pull request when pull requests are required.
|
||||
|
||||
You can only give push access to a protected branch to users, teams, or installed {% data variables.product.prodname_github_apps %} with write access to a repository. People and apps with admin permissions to a repository are always able to push to a protected branch.
|
||||
{% if restrict-pushes-create-branch %}
|
||||
Optionally, you can apply the same restrictions to the creation of branches that match the rule. For example, if you create a rule that only allows a certain team to push to any branches that contain the word `release`, only members of that team would be able to create a new branch that contains the word `release`.
|
||||
{% endif %}
|
||||
|
||||
You can only give push access to a protected branch, or give permission to create a matching branch, to users, teams, or installed {% data variables.product.prodname_github_apps %} with write access to a repository. People and apps with admin permissions to a repository are always able to push to a protected branch or create a matching branch.
|
||||
|
||||
### Allow force pushes
|
||||
|
||||
|
||||
@@ -105,9 +105,11 @@ When you create a branch rule, the branch you specify doesn't have to exist yet
|
||||

|
||||
1. Optionally,{% ifversion fpt or ghec %} if your repository is owned by an organization using {% data variables.product.prodname_team %} or {% data variables.product.prodname_ghe_cloud %},{% endif %} enable branch restrictions.
|
||||
- Select **Restrict who can push to matching branches**.
|
||||

|
||||
- Search for and select the people, teams, or apps who will have permission to push to the protected branch.
|
||||

|
||||
{% if restrict-pushes-create-branch %}
|
||||
- Optionally, to also restrict the creation of matching branches, select **Restrict pushes that create matching branches**.
|
||||
{% endif %}
|
||||
- Search for and select the people, teams, or apps who will have permission to push to the protected branch or create a matching branch.
|
||||
![Branch restriction search]{% if restrict-pushes-create-branch %}(/assets/images/help/repository/restrict-branch-search-with-create.png){% else %}(/assets/images/help/repository/restrict-branch-search.png){% endif %}
|
||||
1. Optionally, under "Rules applied to everyone including administrators", select **Allow force pushes**.
|
||||

|
||||
{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5624 %}
|
||||
|
||||
7
data/features/restrict-pushes-create-branch.yml
Normal file
7
data/features/restrict-pushes-create-branch.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
# Issue 6045
|
||||
# Restrict pushes that create matching branches option, within branch restrictions
|
||||
versions:
|
||||
fpt: '*'
|
||||
ghec: '*'
|
||||
ghes: '>=3.6'
|
||||
ghae: 'issue-6045'
|
||||
Reference in New Issue
Block a user