{{< details >}}
- Tier: 专业版, 旗舰版
- Offering: JihuLab.com, 私有化部署
{{< /details >}}
您可以通过使用 REST API 管理项目的 推送规则。
获取项目推送规则
获取项目的推送规则。
GET /projects/:id/push_rule
支持的属性:
属性 | 类型 | 是否必需 | 描述 |
---|---|---|---|
id |
integer or string | 是 | 项目的 ID 或 URL 编码路径 |
示例响应:
{
"id": 1,
"project_id": 3,
"commit_message_regex": "Fixes \\d+\\..*",
"commit_message_negative_regex": "ssh\\:\\/\\/",
"branch_name_regex": "",
"deny_delete_tag": false,
"created_at": "2012-10-12T17:04:47Z",
"member_check": false,
"prevent_secrets": false,
"author_email_regex": "",
"file_name_regex": "",
"max_file_size": 5,
"commit_committer_check": false,
"commit_committer_name_check": false,
"reject_unsigned_commits": false,
"reject_non_dco_commits": false
}
添加项目推送规则
向指定项目添加推送规则。
POST /projects/:id/push_rule
支持的属性:
属性 | 类型 | 是否必需 | 描述 |
---|---|---|---|
id |
integer or string | 是 | 项目的 ID 或 URL 编码路径 |
author_email_regex |
string | 否 | 所有提交作者的电子邮件必须匹配此正则表达式。 |
branch_name_regex |
string | 否 | 所有分支名称必须匹配此正则表达式。 |
commit_message_negative_regex |
string | 否 | 不允许任何提交消息匹配此正则表达式。 |
commit_message_regex |
string | 否 | 所有提交消息必须匹配此正则表达式。 |
deny_delete_tag |
boolean | 否 | 禁止删除标签。 |
file_name_regex |
string | 否 | 所有提交的文件名必须不匹配此正则表达式。 |
max_file_size |
integer | 否 | 最大文件大小(MB)。 |
member_check |
boolean | 否 | 限制提交作者(电子邮件)为现有的极狐 GitLab 用户。 |
prevent_secrets |
boolean | 否 | 极狐 GitLab 拒绝任何可能包含密钥的文件。 |
commit_committer_check |
boolean | 否 | 用户只能推送提交到此仓库,如果提交者的电子邮件是他们自己验证过的电子邮件之一。 |
commit_committer_name_check |
boolean | 否 | 用户只能推送提交到此仓库,如果提交作者名称与他们的极狐 GitLab 账户名称一致。 |
reject_unsigned_commits |
boolean | 否 | 拒绝未签名的提交。 |
reject_non_dco_commits |
boolean | 否 | 拒绝未获得 DCO 认证的提交。 |
编辑项目推送规则
编辑指定项目的推送规则。
PUT /projects/:id/push_rule
支持的属性:
属性 | 类型 | 是否必需 | 描述 |
---|---|---|---|
id |
integer or string | 是 | 项目的 ID 或 URL 编码路径 |
author_email_regex |
string | 否 | 所有提交作者的电子邮件必须匹配此正则表达式。 |
branch_name_regex |
string | 否 | 所有分支名称必须匹配此正则表达式。 |
commit_message_negative_regex |
string | 否 | 不允许任何提交消息匹配此正则表达式。 |
commit_message_regex |
string | 否 | 所有提交消息必须匹配此正则表达式。 |
deny_delete_tag |
boolean | 否 | 禁止删除标签。 |
file_name_regex |
string | 否 | 所有提交的文件名必须不匹配此正则表达式。 |
max_file_size |
integer | 否 | 最大文件大小(MB)。 |
member_check |
boolean | 否 | 限制提交作者(电子邮件)为现有的极狐 GitLab 用户。 |
prevent_secrets |
boolean | 否 | 极狐 GitLab 拒绝任何可能包含密钥的文件。 |
commit_committer_check |
boolean | 否 | 用户只能推送提交到此仓库,如果提交者的电子邮件是他们自己验证过的电子邮件之一。 |
commit_committer_name_check |
boolean | 否 | 用户只能推送提交到此仓库,如果提交作者名称与他们的极狐 GitLab 账户名称一致。 |
reject_unsigned_commits |
boolean | 否 | 拒绝未签名的提交。 |
reject_non_dco_commits |
boolean | 否 | 拒绝未获得 DCO 认证的提交。 |
删除项目推送规则
从项目中删除推送规则。
DELETE /projects/:id/push_rule
支持的属性:
属性 | 类型 | 是否必需 | 描述 |
---|---|---|---|
id |
integer or string | 是 | 项目的 ID 或 URL 编码路径 |