Updated on 2025-07-24 GMT+08:00

Configuring Protected Branch Rules

Protected Branch Rules Overview

CodeArts Repo makes a code branch more secure by preventing anyone other than the administrator from committing code, preventing anyone from forcibly committing code, or from deleting the branch. You can set this branch to be protected.

Constraints

Project manager or project administrator can configure project-level protected branch rules. For details, see Configuring Project-Level Permissions.

Configuring Protected Branch Rules

The process is as follows:

If you want all repository groups and repositories in this project to use the preceding settings, select Force Inherit.

  1. On the CodeArts Repo homepage, access the Scrum_Test project, choose Settings > Policy Settings > Protected Branches, and click Create Protected Branch, as shown in the following figure.

    Figure 1 Project-level protected branch page

  2. As shown in the following figure, Branch_* indicates that all branches starting with Branch_ are protected branches, and only codehub_mtest_022 can be pushed and merged.

    If a branch contains a single slash (/), the branch cannot be matched using the wildcard * due to the fnmatch syntax rule.

Related Operations

When you commit a code file, if an error message indicating you have no permission to commit to the target protected branch (DEV-23-8040) is displayed, the branch you are committing is a protected branch and you need to contact an administrator to grant you the commit permission.

Video Tutorial