Hi,
I have the following issue, which was somehow discussed in the PR of the feature "feat(cli): Implement --hook option for git hooks integration":
When using the proposed hook solution together with husky, I am not able to skip the git hooks when using standard-version's release command (see command here).
Basically, this is what I have and do (used in my react-component-catalog package):
// package.json
"scripts": {
"release": "standard-version"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"prepare-commit-msg": "exec < /dev/tty && git cz --hook"
}
},
Whenever I release something, I execute one of these commands:
npm run release -- --no-verify
# or
npx standard-version --no-verify
This results in the following error:

I want to be able to use commitizen together with standard-version when creating a new release.
How? Either it would be great to tell the git cz command to skip interactive mode or entirely for this specific task, or I should use another hook (which I have not yet tested though).
Whatever is better, I am happy if someone can assist me here. 馃憤
During my research I stumbled upon an issue raised in the husky package. He wanted to create "(...) a custom prepare-commit-msg hook that appends an ID to the commit msg." and also had troubles skipping it.
He got a response containing the following hint:
commit-msg hook better suits your needs.
Because prepare-commit-msg does not allow --no-verify...
prepare-commit-msg
[...]
The purpose of the hook is to edit the message file in place, and it is not suppressed by the--no-verifyoption.commit-msg
[...] can be bypassed with the--no-verifyoption.
[...] It can also be used to refuse the commit after inspecting the message file.
https://git-scm.com/docs/githooks#_prepare_commit_msg
Does that mean I should use commit-msg instead to make this work? But then people are not enforced anymore to use commitizen...
Thank you for your help!
@natterstefan I remember using the prepare-commit-msg for exactly the reason you're describing above about wanting to _enforce_ the users to enter a properly formatted commit message via commitizen.
Even though the prepare-commit-msg hook isn't suppressed with the no-verify option, maybe we can check if --no-verify is also present, and give an exit code.
I'll take a look at it - in the meantime, something useful would be to generate a sandbox environment to make it easier for me to replicate the error
Hi @olgn, thanks for your response. Yes I can. I added a todo onto my list and let you know when it's ready. Should be simple and not complicated, but still I can't do it immediatelly.
@natterstefan thanks!
Hi @olgn, here's an example repository: https://github.com/natterstefan/example-commitizen-standard-version.
I've set up git-hooks (husky with prepare-commit-msg), and standard-version (available with npm run release and npm run release -- --no-verify).
Hopefully this helps, if not let me know how I can be of help for you.
best,
Stefan
Hi @olgn 馃憢,
were you able to take a look at the provided example already? Thank you for your help.
best,
Stefan
Howdy @natterstefan - try this - Husky just put out a check for the HUSKY_SKIP_HOOKS variable (issue here)- this will skip all husky hooks, which I think gets the bahaviour you would like.
package.json:
{
...
"scripts": {
....
"release": "HUSKY_SKIP_HOOKS=1 standard-version",
...
}
}
Please let me know how this works for you.
@olgn Awesome, it worked. Thanks for helping me!

@natterstefan happy to help.
@olgn Thank you!
Most helpful comment
Howdy @natterstefan - try this - Husky just put out a check for the
HUSKY_SKIP_HOOKSvariable (issue here)- this will skip all husky hooks, which I think gets the bahaviour you would like.package.json:
Please let me know how this works for you.