commitizen / cz-cli

The commitizen command line utility. #BlackLivesMatter
http://commitizen.github.io/cz-cli/
MIT License
16.7k stars 547 forks source link

git commit not returning to prompt #809

Open poorpaddy opened 3 years ago

poorpaddy commented 3 years ago

After running git commit and going through the interactive prompts, commitizen doesn't return to prompt. Instead it puts me into vim and am forced to exist with :qa.

I'm using the husky method:

"husky": {
  "hooks": {
    "prepare-commit-msg": "exec < /dev/tty && git cz --hook || true",
  }
}

My environment: OSX: 10.15.7 Yarn 1.22.10 Node 12.20.1 NPM 6.14.10 commitizen: 4.2.3 cz-conventional-changelog: 3.3.0

ozum commented 3 years ago

Same here. Until today, commitizen was working well.

OSX: 11.2 Node: 15.8.0 NPM: 7.5.2 commitizen: 4.2.3 husky: 5.0.8

prepare-commit-msg

#!/bin/sh
. "$(dirname $0)/_/husky.sh"

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

I also got this error message: "could not determine executable to run".

I got the same message when I manually execute npx --no-install git cz --hook.

Are there any steps to collect further info for diagnosis?

EDIT:

git-cz is locally installed and npx git-cz works.

Can I use exec < /dev/tty && npx --no-install git-cz --hook || true until a solution found?

raveracker commented 2 years ago

I think changing the prepare-commit-msg to below works

#!/bin/sh
. "$(dirname $0)/_/husky.sh"

exec < /dev/tty && npx git-cz --hook || true 
ZhangDaZongWei commented 2 years ago

👆

ThomasBouasli commented 2 years ago

I think changing the prepare-commit-msg to below works

#!/bin/sh
. "$(dirname $0)/_/husky.sh"

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

This doesn't solve the issue. Maybe it has something to do with yarn?

mvahedii commented 2 years ago

I think changing the prepare-commit-msg to below works

#!/bin/sh
. "$(dirname $0)/_/husky.sh"

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

This doesn't work! and vim open again.

ghost commented 2 years ago

Same issue here

Revolt9k commented 1 year ago

Same problem. Cant find solution

palvol commented 1 year ago

had the same problem on ubuntu 22.04 node v16.18.1 but after trying with git-cz error changed to:

npx --no-install git-cz
npm ERR! canceled

:shrug:

arjansunar commented 1 year ago

I solved it by adding commitizen as a devDependency to the project. The husky hook requires commitizen to be installed locally as mentioned in notes.

Check to install locally