All Products
Search
Document Center

Alibaba Cloud DevOps:Push rule settings

Last Updated:May 16, 2025

Codeup supports commit check with custom rules to standardize commits. Learn how to create a push rule.

Create a push rule

  1. Log on to Codeup as administrator and select the target repository.

  2. Click Settings in the lower-left corner.

  3. Click Push Rules. image

  4. On the Push Rule Settings page, click Create Push Rule and then configure the rule.

    image

  • Commit Description: Specify the regular expression for commit messages.

  • Commit Email Address: Specify the regular expression for email address. It checks if email address specified in git config matches the regular expression.

  • File Limits: Specify the regular expression for commit messages.

  • Disable Forcible Push: Disabling force push avoids code from being overwritten and commit history being lost.

    Note

    If force push is disabled, git push -f command let you push code only when the local branch has not diverged from the remote repository.

  • Code Owner Check: Select the Check Rules and the Limit Level. Codeup checks if the logged-in user's information matches the configuration in git config:

    git config --global user.name "Your name"
    git config --global user.email "Your email address"

    If not matched, Codeup will warn the logged-in user or block the push as you configured.

About Author and Committer

In Git, the Author and Committer represent distinct roles:

Role

Definition

Configuration method

Author

The actual code writer

git commit --author="Name <email>"

Committer

The person who executes git commit or git push.

git config user.name/email

Key differences

  • Author won't change: Even when rewriting history via git cherry-pick or git rebase, the Author remains the original contributor.

  • Committer updates dynamically: Every commit operation replaces the Committer with the current user's configured information.

Common Use Cases

  • Direct commit: Author and Committer are the same.

  • Proxy commit: Use git commit --author to specify the Author, while the Committer becomes the person executing the command (e.g., a code reviewer).

  • History rewriting: git cherry-pick preserves the original Author, but the Committer becomes the current user.

Best Practices

  • Open-source projects: Even if you don't directly use someone's code, explicitly credit their idea using --author.

  • Enterprise collaboration: Standardize committer email configurations to avoid misattribution.

Inherit organization-level rules

Push rules inherited from an organization cannot be edited or deleted. You can only view the rules. To modify them, contact the organization administrator.

An example of check rule configuration

The check rule specified in the following screenshot means that it checks the author, and it only warns the user if the check fails.image