You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commitizen-branch with pre-commit prevents from push to origin with exit code 23 #704
Whenever I try to push a commit to the origin (git push -u origin main), an error is preventing me from pushing:
commitizen check branch..................................................Failed
- hook id: commitizen-branch
- exit code: 23
fatal: ambiguous argument 'origin/HEAD..HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
error: failed to push some refs to 'https://github.com/<some repo>.git'
Steps to reproduce
Run cz init.
Run pre-commit install --hook-type commit-msg --hook-type pre-push
Run git init && git add . && git commit -m "feat: my new commit"
Run git remote add origin https://github.com/<some repo>.git
Run git push -u origin main
Current behavior
I should be able to push it correctly to origin.
Desired behavior
I want to push it to origin.
Screenshots
No response
Environment
Commitizen Version: 2.42.1
Python Version: 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110]
Operating System: Linux
Activity
Corfucinas commentedon Jun 19, 2023
I have exactly the same bug
vabatta commentedon Jun 19, 2023
If you are using dev containers, for me it worked by cleaning my local dev container and let it rebuild.
Corfucinas commentedon Jun 23, 2023
Any quick solution to this bug? (that is not
--no-verify)eadgbear commentedon Aug 15, 2023
I'm still seeing this as well. I added
czto an existing repo, but in a new branch that did not exist onoriginyet, if that helps.eadgbear commentedon Aug 17, 2023
For anyone still running into this, here's how you fix it:
git remote set-head origin --autoFor whatever reason,
HEADwas not set in my repo.Before:
$ git branch -a * dev/initial_structure main remotes/origin/dev/initial_structure remotes/origin/mainAfter:
style: disable commitizen-branch due to errors when initializing a pr…
style: disable commitizen-branch due to errors when initializing a pr…