Skip to content

Getting reference not found locally and in gitlab pipeline #558

@MartinWilkerson

Description

@MartinWilkerson

As the title says, I'm getting the 'reference not found' error when running commitsar on my repo both locally and when running in gitlab CI pipelines.

When run locally in docker with my project folder mounted as a volume, I get the following:

docker run -it --rm --entrypoint /bin/sh -v .:/src aevea/commitsar
/app # cd /src
/src # /app/commitsar -v
2025/06/14 20:16:12 config file not found, using defaults
   • Starting pipeline: commit-pipeline
   • Starting analysis of commits on branch refs/heads/enforce-conventional-commits
   • [commit-pipeline] reference not found
   • All pipelines complete
   ⨯ pipeline: commit-pipeline, error: reference not found
some errors were found

I get the same error in the gitlab pipeline (though running without -v), which I originally thought would be because of the fetch depth but it still errors with that set to 0 and since it also happens locally I suspect that might not be it. But just in case, my pipeline job is:

enforce-conventional-commits:
  stage: test
  image:
    name: aevea/commitsar
    pull_policy: always
  variables:
    GIT_DEPTH: 0
  before_script:
    - git checkout "$CI_COMMIT_REF_NAME"
  script:
    - commitsar

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions