Share Git Hooks With core.hooksPath

Store hooks in the repository and point Git at them for the whole team.

macOSautomationgitcliLow risk
Run git config core.hooksPath .githooks to load hooks from a tracked directory.

01Command

Command
$ git config core.hooksPath .githooks

02What it does

Hooks can lint, format or run tests before a commit, but .git/hooks is not versioned. Committing a .githooks directory and setting core.hooksPath shares the checks automatically, turning a manual practice into enforced automation.

03Risk

RiskLow risk
RequirementsGit 2.20+ (install with Homebrew or Xcode Command Line Tools)
CompatibilitymacOS with Git installed (Homebrew or Xcode Command Line Tools)
!Warning: Hooks run arbitrary code on checkout-independent actions; review changes to hook scripts before committing them.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • git-githooks documentation
    Git · vendor-doc · 2026-09-20
    Evidence: Documents client-side hooks including pre-commit and core.hooksPath.

Last verified: 2026-10-13 · Category: Developer