protect_branch
Set push, merge, and unprotect access levels for a branch, optionally allow force push or require code owner approval.
Instructions
Protect a repository branch (set push/merge/unprotect access levels)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | No | Project ID or complete URL-encoded path to project | |
| branch_name | Yes | Branch name or wildcard pattern to protect | |
| name | No | Deprecated alias for branch_name; prefer branch_name for consistency | |
| push_access_level | No | Access level for pushing (0=No access, 30=Developer, 40=Maintainer, 60=Admin). GitLab default applies when omitted. | |
| merge_access_level | No | Access level for merging (0=No access, 30=Developer, 40=Maintainer, 60=Admin). GitLab default applies when omitted. | |
| unprotect_access_level | No | Access level for unprotecting (0=No access, 30=Developer, 40=Maintainer, 60=Admin). GitLab default applies when omitted. | |
| allow_force_push | No | Allow force push to the protected branch. Default: false | |
| code_owner_approval_required | No | Require code owner approval before merging (PREMIUM). Default: false |