Interview Prep/Git & GitHub/Config, Line Endings, Files and Platform Quirks

`pre-commit install` fails with `[ERROR] Cowardly refusing to install hooks with core.hooksPath set.`

IntermediateTroubleshootingConfig, Line Endings, Files and Platform Quirks
Answer

Likely causes → core.hooksPath is set somewhere (often globally by a corporate security tool, or by Husky in the repo). Git would ignore .git/hooks, so pre-commit refuses to install there.

Diagnose → git config --show-origin --show-scope --get-all core.hooksPath

Fix → If the setting is a leftover, unset it (git config --unset-all core.hooksPath at the right scope) and re-run pre-commit install. If a global hook directory is mandatory, have its hooks call pre-commit as well, or set a repo-local core.hooksPath that points to a directory with both.

Prevent → Pick one hook manager per repo and document it; avoid stacking Husky, pre-commit and global hooks.

All Git & GitHub questions Roadmap: Git & GitHub

More on Config, Line Endings, Files and Platform Quirks