commitizen / commitizen/cz-cli

husky hook does not work

未关闭
#981 4 条评论 3 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
17.5k
派生
566
平均合并
8 小时 16 分钟
30 天内合并 PR
1

描述

[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)

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。