Skip to content

Add push rules to a group

POST
/api/v4/groups/{id}/push_rule

Adds push rules to a specified group. Use only if you have not defined any push rules so far.

id
required
string

The ID or URL-encoded path of a group

Media type application/json
object
deny_delete_tag

Deny deleting a tag

boolean
nullable
member_check

Restrict commits by author (email) to existing GitLab users

boolean
nullable
prevent_secrets

GitLab will reject any files that are likely to contain secrets

boolean
nullable
commit_message_regex

All commit messages must match this

string
nullable
Example
Fixed \d+\..*
commit_message_negative_regex

No commit message is allowed to match this

string
nullable
Example
ssh\:\/\/
branch_name_regex

All branches names must match this

string
nullable
Example
(feature|hotfix)\/.*
author_email_regex

All commit author emails must match this

string
nullable
Example
@my-company.com$
file_name_regex

All committed filenames must not match this

string
nullable
Example
(jar|exe)$
max_file_size

Maximum file size (MB)

integer
nullable
Example
20
commit_committer_check

Users can only push commits to this repository if the committer email is one of their own verified emails.

boolean
nullable
Example
true
commit_committer_name_check

Users can only push commits to this repository if the commit author name is consistent with their GitLab account name.

boolean
nullable
Example
true
reject_unsigned_commits

Reject commit when it’s not signed.

boolean
nullable
Example
true
reject_non_dco_commits

Reject commit when it’s not DCO certified.

boolean
nullable
Example
true

Created

Media type application/json
object
id
integer format: int64
created_at
string format: date-time
commit_message_regex
string
commit_message_negative_regex
string
branch_name_regex
string
author_email_regex
string
file_name_regex
string
deny_delete_tag
boolean
member_check
boolean
prevent_secrets
boolean
max_file_size
integer
commit_committer_check
boolean
commit_committer_name_check
boolean
reject_unsigned_commits
boolean
reject_non_dco_commits
boolean
Example
{
"id": 2,
"created_at": "2020-08-31T15:53:00.073Z",
"commit_message_regex": "[a-zA-Z]",
"commit_message_negative_regex": "[x+]",
"branch_name_regex": "[a-z]",
"author_email_regex": "^[A-Za-z0-9.]+@gitlab.com$",
"file_name_regex": "(exe)$",
"member_check": true,
"max_file_size": 100
}

Validation error

Not found

Unprocessable entity