I'm trying to setup pre-commit
for a Python project's repository. Upon running pre-commit install
I see an output like this:
[INFO] Installing environment for https://github.com/asottile/seed-isort-config.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pre-commit/mirrors-isort.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pre-commit/mirrors-pylint.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
What are these "environments" and where are they being installed to?
The hooks are all stored in the hooks subdirectory of the Git directory. In most projects, that's . git/hooks .
make a Terraform change, git add and git commit . pre-commit will regenerate your Terraform docs, after which you can rerun git add and git commit to commit the code and doc changes together.
Use the --no-verify option to skip git commit hooks, e.g. git commit -m "commit message" --no-verify . When the --no-verify option is used, the pre-commit and commit-msg hooks are bypassed.
The environments are installed into a cache:
pre-commit
by default places its repository store in~/.cache/pre-commit
-- this can be configured in two ways:
PRE_COMMIT_HOME
: if set,pre-commit
will use that location instead.XDG_CACHE_HOME
: if set,pre-commit
will use$XDG_CACHE_HOME/pre-commit
following the XDG Base Directory Specification.
disclaimer: I am the author
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With