Commit Rules
To configure commit rules, you can choose
on the repository details page.On the Commit Rules page, you can establish a series of code commit verification and restriction rules to ensure code quality. The settings take effect only for the configured repository.
All repository members can view this page. For details about whether a repository member has repository setting permissions, refer to the Permissions page.
Parameter |
Description |
---|---|
Reject non-signed-off-by commits |
Only signed-off-by commits are pushed to the repository. CodeArts Repo signature mode: When performing online commit in CodeArts Repo, use the following format to compile and submit information: commit message # Enter the customized submission information. # This is a blank line. Signed-off-by: User-defined signature # Enter the user-defined signature after Signed-off-by: Git client signature mode: When running the commit command on the Git client, you need to add the -s parameter. git commit -s -m "<your commit message>" You need to configure the signature and email address on the client in advance. |
Reject commits not signed by GPG |
Only GPG-signed commits are pushed to the repository. Configure a GPG key: git config --global user.signingkey "your GPG private key" Git client signature mode: When running the commit command on the Git client, you need to add the -S parameter. git commit -S -m "Your commit message" When running the tag command on the Git client, you need to add the -s parameter. git tag -s -m "Your tag message" You need to configure the signature and email address on the client in advance. |
Tags cannot be deleted |
After this option is selected, tags cannot be deleted on the page or by running commands on the client. |
Prevent committing secrets |
Confidential files include id_rsa and id_dsa. For details, see Description of Confidential Files. |
Prevent git push -f |
Indicates whether users can run the git push -f command on the client to push code. git push -f indicates that the current local code repository is pushed to and overwrites the code in CodeArts Repo. In general cases, you are not advised using this command. |
Creating a Commit Rule
The repository administrator and repository owner can create a commit rule for a branch of the repository. Only one commit rule can be set for each branch.
Priority matching mechanism of commit rules:
1. The target branch preferentially matches the configured commit rules.
2. If no rule is exactly matched, the first rule fuzzily match is used.
3. If no rule is fuzzily matched, the default rule is used.
Parameter |
Description |
---|---|
Rule Name |
This parameter is mandatory. The value contains a maximum of 200 characters. |
Branch |
This parameter is mandatory. Select a branch from the drop-down list or create a regular expression. This field supports a maximum of 500 characters. |
Commit rules |
Parameters in this area are optional.
|
Basic Attributes |
Parameters in this area are optional.
NOTE:
When a repository is created, the maximum size of a single file in the default submission rule (default) is 200 MB. When a repository is created, the recommended maximum size of a single file in the default submission rule is 50 MB. |
Binary Rules |
Parameters in this area are optional. These parameters are not set by default, indicating that binary files can be uploaded. The size of a single file cannot exceed the upper limit. Allow changes to binary files, Repo File Whitelist, and Privileged User take effect only when Do not allow new binary files is selected. If you select Allow changes to binary files, binary files in modifiable state are not intercepted and can be directly uploaded. Binary files can be deleted without binary check.
NOTE:
Repository members with the push permission can be privileged users. |
Effective Date |
Parameters in this area are optional. Before being pushed, all commitments created after the date specified by this parameter must match the hook settings. If this parameter is left empty, all commitments are checked regardless of the committing date. |
You are not advised storing binary files in CodeArts Repo. Otherwise, the performance and stability of the code repository will be affected.
Rule |
Examples |
---|---|
Single a, b, or c |
[abc] |
Characters other than a, b, or c |
[^abc] |
Lowercase letters ranging from a to z |
[a-z] |
Characters other than the range of a to z |
[^a-z] |
Uppercase and lowercase letters in the range of a to z or A to Z |
[a-zA-Z] |
Any single character |
. |
Either a or b |
a|b |
Any blank character |
\s |
Non-blank character |
\S |
Arabic numeral character |
\d |
Non-Arabic numeral characters |
\D |
Letters, digits, or underscores (_) |
\w |
Characters other than letters, digits, or underscores (_) |
\W |
Match the content in parentheses (not capture) |
(?:...) |
Match and capture the content in parentheses |
(...) |
No or one a |
a? |
No or more a's |
a* |
One or more a's |
a+ |
Three a's |
a{3} |
More than three a's |
a{3,} |
3 to 6 a's |
a{3,6} |
Beginning of text |
^ |
End of text |
$ |
Word boundary |
\b |
Non-word boundary |
\B |
Line breaker |
\n |
Carriage return character |
\r |
Tab key |
\t |
Null string |
\0 |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot