WindowsmacOSLinux

Where Does CaptainHook Store Its Config?

CaptainHook keeps hook actions in captainhook.json, with personal overrides in captainhook.config.json right beside it.

Last updated

CaptainHook configures PHP git hooks through captainhook.json: per-hook enable switches plus action lists (commands, validators, custom classes). The configure command scaffolds it; install wires it into .git.

Teams share the main file and ignore nothing, while individuals layer captainhook.config.json for machine specific needs. The includes system goes further, letting orgs split common rules into vendored files every repo pulls in.

Where CaptainHook stores this, by platform

Windows
[RepoDir]\captainhook.json

Hook blocks with actions and conditions. Installed shims live in .git/hooks. The hook-installer composer plugin re-runs install on every composer command.

macOS
[RepoDir]/captainhook.json

Same files. Placeholders ({$STAGED_FILES} and friends) inject hook context into commands without wrapper scripts.

Linux
[RepoDir]/captainhook.json

Same layout. run-path and includes-level settings matter when the git dir sits apart from the json, as in worktrees and submodules.

Frequently asked questions

Hooks do nothing after a fresh clone. What is missing?

Run vendor/bin/captainhook install. Cloning never carries .git hooks, so the json can be perfect while nothing executes until the shims exist.

Can I tweak settings without editing the committed file?

Create captainhook.config.json next to captainhook.json (exact name, same dir). It overrides shared settings locally, which keeps personal verbosity and paths out of version control.

Notice an outdated path? Let us know.