Commit 1f4d4277 authored by Suzanne Selhorn's avatar Suzanne Selhorn Committed by Craig Norris

Edited Protected branches for CTRT

parent a06e74d6
......@@ -176,7 +176,7 @@ If the key is **privately accessible** and in use by other projects, it will be
If the owner of this deploy key doesn't have access to a [protected
branch](../protected_branches.md), then this deploy key doesn't have access to
the branch either. In addition to this, choosing the **No one** value in
[the "Allowed to push" section](../protected_branches.md#configuring-protected-branches)
[the "Allowed to push" section](../protected_branches.md#configure-a-protected-branch)
means that no users **and** no services using deploy keys can push to that selected branch.
Refer to [this issue](https://gitlab.com/gitlab-org/gitlab/-/issues/30769) for more information.
......@@ -7,46 +7,45 @@ type: reference, howto
# Protected branches **(FREE)**
[Permissions](../permissions.md) in GitLab are fundamentally defined around the
In GitLab, [permissions](../permissions.md) are fundamentally defined around the
idea of having read or write permission to the repository and branches. To impose
further restrictions on certain branches, they can be protected.
## Overview
The default branch for your repository is protected by default.
By default, a protected branch does these things:
## Who can access a protected branch
- It prevents its creation, if not already created, from everybody except users
with Maintainer permission.
- It prevents pushes from everybody except users with **Allowed** permission.
- It prevents **anyone** from force pushing to the branch.
- It prevents **anyone** from deleting the branch.
When a branch is protected, the default behavior enforces
these restrictions on the branch.
**Permissions:**
| Action | Who can do it |
|--------------------------|---------------|
| Protect a branch | Maintainers only. |
| Push to the branch | GitLab administrators and anyone with **Allowed** permission. (*) |
| Force push to the branch | No one. |
| Delete the branch | No one. |
- GitLab administrators are allowed to push to the protected branches.
- Users with [Developer permissions](../permissions.md) are allowed to
create a project in a group, but might not be allowed to initially
push to the [default branch](repository/branches/default.md).
(*) Users with developer permissions can create a project in a group,
but might not be allowed to initially push to the [default branch](repository/branches/default.md).
The default branch protection level is set in the [Admin Area](../admin_area/settings/visibility_and_access_controls.md#default-branch-protection).
### Set the branch protection default level
See the [Changelog](#changelog) section for changes over time.
The default branch protection level is set in the [Admin Area](../admin_area/settings/visibility_and_access_controls.md#default-branch-protection).
## Configuring protected branches
## Configure a protected branch
To protect a branch, you need to have at least Maintainer permission level.
The default branch for your repository is protected by default.
Prerequisite:
1. In your project, go to **Settings > Repository**.
1. Scroll to find the **Protected branches** section.
1. From the **Branch** dropdown menu, select the branch you want to protect and
click **Protect**. In the screenshot below, we chose the `develop` branch.
- You must have at least maintainer permissions.
![Protected branches page](img/protected_branches_page_v12_3.png)
To protect a branch:
1. Once done, the protected branch displays in the **Protected branches** list.
1. Go to your project and select **Settings > Repository**.
1. Expand **Protected branches**.
1. From the **Branch** dropdown menu, select the branch you want to protect.
1. Select **Protect**.
![Protected branches list](img/protected_branches_list_v12_3.png)
The protected branch displays in the **Protected branches** list.
## Using the Allowed to merge and Allowed to push settings
......@@ -141,7 +140,7 @@ all matching branches:
![Protected branch matches](img/protected_branches_matches.png)
## Creating a protected branch
## Create a protected branch
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/53361) in GitLab 11.9.
......@@ -161,7 +160,7 @@ To create a new branch through the user interface:
base the new branch on. Only existing protected branches and commits
that are already in protected branches are accepted.
## Deleting a protected branch
## Delete a protected branch
From time to time, you may need to delete or clean up protected branches.
User with [Maintainer permissions](../permissions.md) and greater can manually delete protected
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment