Help Center/ CodeArts Repo/ FAQs/ Uploading and Downloading Code/ "Error: Deny by project hooks setting 'default': message of commit" Is Reported When Code Repository Is Pushed from the Local Host to CodeArts Repo
Updated on 2024-11-14 GMT+08:00

"Error: Deny by project hooks setting 'default': message of commit" Is Reported When Code Repository Is Pushed from the Local Host to CodeArts Repo

Symptom

If the format of the code file to be pushed to the remote repository is not standard and the ticket number and modifier are not provided, the error information shown in the following figure is displayed.

Figure 1 Error information displayed when code is pushed

Analysis

The commit message does not match the regular-expression: ^\[maven-release-plugin\]|[Trouble ticket number or requirement ticket number]\s*.+\W[Modified description]\s*.+\W[Modified reason]\s*.+\W[Modules] \s*.+\W[Modifier]\s*.+\W[Approver]\s*.+

Figure 2 Commit message when code is pushed

Solution

  • To modify the latest incorrect commit message, perform the following operations.
  1. Perform the following operations to modify the latest incorrect commit message:

    Right-click the .git hidden folder and choose Open Git Bash here from the shortcut menu to open Git Bash.

  2. Run the git log command to find the incorrect commit message.
  3. Run the git commit --amend -m command to access the vi text editor.
  4. Run the git commit --amend -m ' command, enter the information in the first line, and press Enter. Enter the information in the second line, and repeat the process to the last line. Add the other single quotation mark at the end of the last line, and press Enter. The modification is successful.

    Figure 3 Modifying the commit message

  • To modify the incorrect commit message that is not the latest, perform the following operations.
  1. To modify the second-to-last commit message, perform the following operations:

    Run the git log command on Git Bash to search for incorrect commit messages.

  2. Run the git reset --hard commitID command to roll back to the previous commit ID before this one.
  3. Run 3 and 4 to modify the commit message.