<!-- @generated by usage-cli from usage spec -->

# `hk install`

- **Usage**: `hk install [FLAGS]`
- **Aliases**: `i`
- **Effect**: modifies state

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.

If hk is already configured globally (any `hook.hk-*` entry in `~/.gitconfig`), the per-repo install is skipped — and any stale local hooks are cleaned up — so the global install remains the single source of truth and hk doesn't fire twice per event. Pass `--force-local` to install local hooks anyway.

## Flags

### `--force-local`

Install local hooks even when hk is already configured globally
(any `hook.hk-*` entry in `~/.gitconfig`). By default a per-repo
install is skipped in that case to avoid hk firing twice per
event. Not compatible with `--global`.

### `--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.
