{
  "id": 17435591,
  "title": "Git Hooks Not Running for Teammates? Husky vs Lefthook vs pre-commit",
  "url": "https://urgent.news/2026/10/31/git-hooks-not-running-for-teammates-husky-vs-lefthook-vs-pre-commit",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-31T17:04:47.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/libme/git-hooks-not-running-for-teammates-husky-vs-lefthook-vs-pre-commit-g6f"
  },
  "original_language": "en",
  "account": "Git hooks may not run for teammates because the .git/hooks/ directory is never committed to the repository. This means that every clone starts with no hooks installed. Husky, Lefthook, and pre-commit are tools designed to solve this issue by installing the necessary hook definitions directly in the repository. Choose Husky if your project is already a Node.js project, opt for Lefthook for a single binary with no runtime dependencies, and go with pre-commit if your team primarily uses Python or needs a wide variety of ready-made hooks.\n\nA common problem arises when hooks work on a user's machine but not on a teammate's. This usually happens because the hooks are stored in a hidden directory that is not part of the repository content. To verify whether hooks are installed, run `git config --get core.hooksPath`. If it returns an empty output, no hooks are installed in the clone. If you see output, then hooks are defined in a custom path.\n\nHusky, Lefthook, and pre-commit handle the installation process differently. Husky utilizes the npm prepare script to automatically install hooks during package installation. Lefthook, on the other hand, uses a YAML configuration file to define its hooks, and it can run them in parallel for improved performance. Pre-commit employs a separate configuration file (`.pre-commit-config.yaml`) and uses its own catalog of pre-written hooks, making it a popular choice for Python-heavy teams.\n\nIf hooks fail to run after adopting one of these tools, there are a few potential issues to check. First, ensure that the install step ran successfully. For Husky, this is done via the `prepare` script in `package.json`. For Lefthook, check the `lefthook install` command was executed, and for pre-commit, ensure that `pre-commit install` was run. Another issue may occur when pre-commit is already set in `core.hooksPath`, preventing new hooks from being installed. In such cases, unset the existing path and re-install the hooks.\n\nLocal Git GUIs and PATH problems can also interfere with hook execution. For example, a hook that calls `npx` or `node` may fail when using a graphical Git client with a different PATH configuration. The built-in single binary solution of Lefthook helps mitigate this issue, but it still relies on the underlying tools to be present in the PATH.\n\nLastly, it is essential to remember that hooks should not be the only form of enforcement for code quality. While hooks provide instant feedback, they can be bypassed, and contributors working on forks have never executed the setup steps. Implementing similar checks in a Continuous Integration (CI) pipeline ensures that the merge process enforces the desired standards. Husky and Lefthook can be configured to run the same commands (e.g., linting, formatting) directly from the CI workflow, ensuring consistency between local and remote environments.",
  "summary": "Git hooks don't run for teammates because .git/hooks/ is never committed, so every clone starts with no hooks at all. Husky, lefthook, and pre-commit all solve this the same way: the hook definitions live in the repo, and an install step points Git at them. Pick husky if your repo is already a Node project, lefthook if you want one fast binary with no runtime dependency, and pre-commit if your…",
  "key_points": [
    "Git hooks may not run for teammates due to .git/hooks/ directory not being committed.",
    "Implement CI pipeline checks to enforce code quality beyond local Git hooks."
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}