Reputation: 1695
I type this into the CLI
git commit -m "Hello World!"
This is the error message I get
husky > commit-msg (node v14.15.3)
⧗ input: Hello World!
✖ subject may not be empty [subject-empty]
✖ type may not be empty [type-empty]
✖ found 2 problems, 0 warnings
ⓘ Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint
husky > commit-msg hook failed (add --no-verify to bypass)
What does this mean?
Upvotes: 71
Views: 108059
Reputation: 3285
I got this error on a project that uses conventional commits and my problem was a leading space in the commit message. As an example:
Incorrect: " Hello world"
Correct: "Hello world"
Upvotes: 1
Reputation: 1139
This has been annoying the heck out of me for a few weeks now. Sometimes it works, sometimes it doesn't.
Here's what I finally figured out: don't use fix, feat, chore, docs, etc. in your actual description part of the message.
Examples:
Wrong fix(something): Fixed the thing
Right fix(something): Unborked the thing
Seems their regex sucks.
Upvotes: 2
Reputation: 2625
To fix the error, change your commit message ("Hello world") to follow the Conventional Commits format, e.g. to "feat: hello world".
As the "Get Help" message link (in your error message) explains, husky calls commitlint to verify that your commit message conforms to this format.
We should always RTFEM !
Upvotes: 97
Reputation: 1593
Another Solution you can try is
git commit --no-verify -m "Hello World!"
git commit -n -m "Hello World!"
References
Upvotes: 32
Reputation: 1
As you installed husky it checks when you commit or push the code in to your github repo. I guess you have installed the commitlint and used it in your .husky precommit file . If so you have to follow the commitlint rules before every commit like "fix: bug-fixes" .
refer:https://commitlint.js.org/#/
Upvotes: 0
Reputation: 1695
I fixed this problem with "npm uninstall husky"
edit: make sure you know what it does and that your project doesn't use it before you remove it.
Upvotes: 14
Reputation: 6726
For me it was a space. Changed
`feat(pill):message here`
to
`feat(pill): message here`
There is a package called husky that defines a certain template for your commit messages. If the template is not fulfilled, one gets strange errors.
Upvotes: 35