Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
1f4d4277
Commit
1f4d4277
authored
May 10, 2021
by
Suzanne Selhorn
Committed by
Craig Norris
May 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Edited Protected branches for CTRT
parent
a06e74d6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
28 deletions
+27
-28
doc/user/project/deploy_keys/index.md
doc/user/project/deploy_keys/index.md
+1
-1
doc/user/project/img/protected_branches_list_v12_3.png
doc/user/project/img/protected_branches_list_v12_3.png
+0
-0
doc/user/project/img/protected_branches_page_v12_3.png
doc/user/project/img/protected_branches_page_v12_3.png
+0
-0
doc/user/project/protected_branches.md
doc/user/project/protected_branches.md
+26
-27
No files found.
doc/user/project/deploy_keys/index.md
View file @
1f4d4277
...
...
@@ -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#configur
ing-protected-branches
)
[
the "Allowed to push" section
](
../protected_branches.md#configur
e-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.
doc/user/project/img/protected_branches_list_v12_3.png
deleted
100644 → 0
View file @
a06e74d6
9.97 KB
doc/user/project/img/protected_branches_page_v12_3.png
deleted
100644 → 0
View file @
a06e74d6
16 KB
doc/user/project/protected_branches.md
View file @
1f4d4277
...
...
@@ -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
)
.
## Configur
ing protected branches
## Configur
e 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
)
## Creat
ing
a protected branch
## Creat
e
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.
## Delet
ing
a protected branch
## Delet
e
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment