Inheritable Branch Protection
The open-source Gitea project supports the branch protection feature. You can create some rules to protect specified branches in your repository. However, in the open-source Gitea project, a repository cannot share its rules with other repositories, which means that you may need to manually create some of the same rules for different repositories.
Gitea Enterprise provides the branch protection inheritance feature. With this feature, you can create some branch protection rules for an organization and have them take effect in all the organization's repositories.
This document explains how to use the branch protection inheritance feature.
Create branch protection rules for an organization
- Navigate to the organization's settings page.
- Navigate to the
Branches
tab. - Click the
Add New Rule
button.
Then you can create branch protection rules for your organization the same way you create rules for a repository.
Make a repository inherit its organization's branch protection rules
- Navigate to the repository's settings page.
- Navigate to the
Branches
tab. - Check the
Enable branch protection inheritance
checkbox.
Branch protection rules inherited from your organization appear in the list with the tag Inherited from organization
.
If you have administrator access to the organization,
the Inherited from organization
tag is a link that navigates to your organization's branches setting page.
Inherited branch protection rules have higher priority than the repository's own rules.
Enable forced branch protection inheritance
You can force all of your organization's repositories to inherit your organization's branch protection rules
by checking the Force enable branch protection inheritance
checkbox.
When you enable the forced branch protection inheritance,
the Enable branch protection inheritance
checkbox is always checked and cannot be unchecked.