sds / overcommit

A fully configurable and extendable Git hook manager
MIT License
3.91k stars 280 forks source link

Getting the exception Overcommit::Exceptions::InvalidGitRepo #808

Closed santoshturamari closed 1 year ago

santoshturamari commented 1 year ago

Hi,

I am using overcommit in our application and has mentioned in general_checks.yml as follows.

- name: Install Overcommit dependencies
       run: |
            gem install bundler --no-document -v "> 2.0" \
            && bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=1 --retry=3 \
            && bundle exec overcommit --sign   

It was running fine till now. But I am experiencing the issue suddenly.

repo_root': Unable to determine location of GIT_DIR. Not a recognizable Git repository! (Overcommit::Exceptions::InvalidGitRepo) /vendor/bundle/ruby/2.7.0/gems/overcommit-0.52.1/lib/overcommit/configuration_loader.rb:53:inload_repo_config'

We have not changed any configuration for github repo.

Because of this, I am unable to push the code. Please help.

@sds

Thank you.

sds commented 1 year ago

The error is telling you that there is no Git repository present wherever you are attempting to run Overcommit.

Perhaps an earlier git clone call in your GitHub Actions workflow failed? Alternatively, when running git rev-parse --show-toplevel, some kind of error occurred in your test environment. You can add OVERCOMMIT_DEBUG=1 as an environment variable to see additional output that might reveal the cause of the error.

Hope this helps.