hk install
- Usage:
hk install [FLAGS] - Aliases:
i
Sets up git hooks to run hk.
The recommended setup is hk install --global, which installs hooks once into the user's ~/.gitconfig so every repository on the machine picks them up automatically. In a project without an hk.pkl, the installed hook exits silently — no-op — so it's safe to enable everywhere. Requires Git 2.54+.
Without --global, hooks are installed into the current repo only. On Git 2.54+ this uses config-based hooks (hook.<name>.command), which keeps .git/hooks/ untouched and composes cleanly with other hook managers. On older Git it falls back to writing script shims.
Flags
--global
Recommended. Install at user level (~/.gitconfig) so every repo on this machine gets hk hooks. Requires Git 2.54 or newer. In repos without an hk.pkl, the installed hook is a silent no-op.
--legacy
Force using the legacy .git/hooks/ script shims instead of Git 2.54+ config-based hooks. Not compatible with --global.
--mise
Use mise x to execute hooks. With this, it won't be necessary to activate mise in order to run hooks with mise tools.
Set HK_MISE=1 to make this default behavior.
