Protected Branches
To configure protected branches, you can choose
on the repository details page.The settings take effect only for the repository configured.
All repository members can view this page. For details about whether a repository member has repository setting permissions, refer to the Permissions page.
Functions of Protected Branches
- Ensure branch security and allow developers to use MRs to merge code.
- Prevent non-administrators from pushing codes.
- Prevent all forcibly push to this branch.
- Prevent anyone from deleting this branch.
![](https://support.huaweicloud.com/intl/en-us/usermanual-codeartsrepo/public_sys-resources/note_3.0-en-us.png)
When you create a repository, the repository automatically sets the default branch (generally master) as the protection branch to ensure repository security.
After you set a protected branch, the protected branch cannot be used as the target branch for code merging.
Editing Protected Branches
- Click Create Protected Branch. In the Added Protected Branch dialog box, select a branch from the drop-down list or manually enter a branch name or wildcard character, select the corresponding permissions or assign permissions to users, and click OK.
- Click
to modify the configuration of the protected branch.
- Click
to delete the protected branch.
- Configure the whitelist: To assign permissions to one or more members of an unauthorized role, you can select Push and Merge under Members and click the drop-down list to add the members to the whitelist.
![](https://support.huaweicloud.com/intl/en-us/usermanual-codeartsrepo/public_sys-resources/note_3.0-en-us.png)
- Only developers, committers, administrators, and project managers have the Push and Merge permissions.
- If Administrator/Project manager, Committer, and Developer are selected for Push, all these roles have the permissions. In this case, you do not need to select Push or Merge under Members.
- You can create, edit, and delete protected branches in batches.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot