跳转到内容
免费试用 Gitea Cloud ☁️ 30 天,加速你的开发与部署!
技术支持
这是 22.6.1 的文档,已不是最新发布版本。查看最新发布版本

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

Section titled “Create branch protection rules for an organization”
  1. Navigate to the organization’s settings page.
  2. Navigate to the Branches tab.
  3. 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.

Organization Branch Protection Rule

Make a repository inherit its organization’s branch protection rules

Section titled “Make a repository inherit its organization’s branch protection rules”
  1. Navigate to the repository’s settings page.
  2. Navigate to the Branches tab.
  3. 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.

Repository Branch Protection Rule

Inherited branch protection rules have higher priority than the repository’s own rules.

Enable forced branch protection inheritance

Section titled “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.

Organization Force Inheritance

When you enable the forced branch protection inheritance, the Enable branch protection inheritance checkbox is always checked and cannot be unchecked.

Repository Force Inheritance