Skip to content

Commitizen-branch with pre-commit prevents from push to origin with exit code 23 #704

Open
@vabatta

Description

@vabatta

Description

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

  1. Run cz init.
  2. Run pre-commit install --hook-type commit-msg --hook-type pre-push
  3. Run git init && git add . && git commit -m "feat: my new commit"
  4. Run git remote add origin https://github.com/<some repo>.git
  5. 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions