Skip to content

commitizen-branch fails with exit code: 23 and message fatal: ..: '..' is outside repository #1923

@thaDude

Description

@thaDude

Description

I cannot get the commitizen-branch hook to work, please see a self-contained demo in the reproduction steps below.

Steps to reproduce

I used uv to bootstrap the project

uv init commitizen-hook-test
cd commitizen-hook-test
uv add pre-commit --dev
uv add commitizen --dev
source .venv/bin/activate
# files below originally generated with cz init
cat << 'EOF' > .pre-commit-config.yaml
repos:
- hooks:
  - id: commitizen
  - id: commitizen-branch
    stages:
    - pre-push
  repo: https://github.com/commitizen-tools/commitizen
  rev: v4.13.9
EOF
cat << 'EOF' > .cz.toml
[tool.commitizen]
name = "cz_conventional_commits"
tag_format = "$version"
version_scheme = "semver2"
version_provider = "scm"
major_version_zero = true
EOF
pre-commit install --hook-type commit-msg --hook-type pre-push
git add *
git commit -am'feat: just a confirming commit'
pre-commit run --hook-stage pre-push

Clean-up

deactivate
cd ..
rm -rf commitizen-hook-test

Current behavior

The pre-push command results in:

commitizen check branch..................................................Failed
- hook id: commitizen-branch
- exit code: 23

fatal: ..: '..' is outside repository at '/Users/<redacted>/commitizen-hook-test'

Desired behavior

I would like the hook to pass.

Screenshots

No response

Environment

Commitizen Version: 4.13.9
Python Version: 3.12.3 (main, Dec 31 2024, 17:41:17) [Clang 15.0.0 (clang-1500.3.9.4)]
Operating System: Darwin

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