Home > database >  Uninstalled pre-commit preventing 'git commit' (pipenv)
Uninstalled pre-commit preventing 'git commit' (pipenv)

Time:03-24

I recently uninstalled pre-commit from my environment. I performed the following in pipenv:

pipenv --rm
<deleted Pipfile and Pipfile.lock>
pipenv install -r requirements.txt 

I ensured that the pre-commit module was no longer in the requirements.txt. When I make a git commit I get:

~/my_project/.venv/bin/python: No module named pre_commit

This is preventing me from committing, and I have no idea where this is coming from, since pre-commit is not being installed. Further, the traceback path specified is pointing to python and not python3. What am I missing?

CodePudding user response:

There are still pre-commit hooks installed in your git repository. You can remove them by simply deleting .git/hooks/pre-commit in you repository, after which pre-commit won't be called anymore when commiting.

CodePudding user response:

typically the way to remove the hook installed by pre-commit install is to call pre-commit uninstall -- though if you've removed pre-commit from your system you can remove the hook scripts manually

you can usually find them by doing:

grep pre-commit.com .git/hooks/*

as that marker is listed in the hook files

from there you can delete them:

grep -l pre-commit.com .git/hooks/* | xargs rm

disclaimer: I made pre-commit

  • Related