commitizen / commitizen/cz-cli

husky hook does not work

Open
#981 4 comments 3 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
17.5k
Forks
566
Avg merge
8h 16m
Merged PRs (30d)
1

Description

[This part of README](https://github.com/commitizen/cz-cli?tab=readme-ov-file#husky) has this:
```json
"husky": {
"hooks": {
"prepare-commit-msg": "exec < /dev/tty && npx cz --hook || true"
}
}
```
But this hook does not work. When I use `git commit` - I get default behavior

If I put this in .husky/prepare-commit-msg:
```sh
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

exec < /dev/tty && npx cz --hook || true

```
And run `git commit` it works but after commitizen I see result commit in nano. How to fix this?
![image](https://github.com/commitizen/cz-cli/assets/66206278/b399e87b-c91f-4e45-8581-27ec3f7e4ccc)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.