Git commit code error husky> pre-commit

After contact with the Git version control for a long period of time will only commit, pull, push these three commands, and did not get to the bottom. And when the morning appeared submitted by front-end code with the code commit the error message husky> pre-commit, then start looking for the reasons behind the success finally resolved by reading relevant information.

First, the problem recurring

I submit code via Git IDEA Editor tool, after previous documents are to be submitted on the check, and submit input description, click commit to submit a success. But the morning in the new code environment, go to commit suddenly given:

Dense red long list of reported information people caught off guard, as are very smooth commit before, I have not seen this battle. At first glance I thought a relationship with the front-end code, because the error message mentioned in the node and npm words and so on.

Second, the process of resolving
a contrast colleague over there is the same code, can still successfully submitted to the repository, so that ruled out the code issues.
While watching so much information being given, uphold the idea of being given just look at the front of a few lines, I will locate in the third line of the error message:

husky > pre-commit (node v12.13.0)

The key word is husky> pre-commit, then Baidu a lot, see a problem, indeed a file in the local project in the .git caused by failure to submit this document is pre-commit file. .git files found in the project folder (need to show hidden files to appear), double-click to enter the number of documents you can see on the git

Show hidden files:


Hooks into the folder and find the file pre-commit, which is the root commit failure lies.

This document is the role:
pre-the commit (client) hook, it will make the code run type style check before submitting information in Git.
If the code does not comply with the appropriate rules, error.
Solution: We delete the file, and then to commit, it can be found successfully submitted.

三、总结
对于Git的应用倒是熟练了,由于不懂原理所以在遇到问题的时候还是需要进行查阅资料,这也算是一种学习的过程,碰到问题,解决问题,并归纳总结。

 

Guess you like

Origin www.cnblogs.com/ostrich-sunshine/p/12397133.html
Recommended