You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
prek install -f fails when global core.hooksPath is set #2426
When git's core.hooksPath is configured globally, running prek install -f inside a repository produces the following error:
❯ prek install -f
error: Refusing to install hooks because core.hooksPath is configured outside this repository.
note: Git will execute hooks from the configured global/system hooks directory, not from this repository's hooks directory.
The -f (force) flag does not override this check.
Why do we need to install the hook? Because even if core.hooksPath is set, the local hook can still be executed via the global hook, such as the following pre-commit script:
The expected behavior is that -f would bypass the error and proceed with the installation, and simply emit a warning about the global hooksPath interfering.
Alternatively, if you made prek install (without -f) emit a warning about core.hooksPath instead of throwing an error, I would be even happier.
Activity
Make `prek install --force` bypass external hooks paths (j178#2437)