DocsCommand reference
install-hook
Install the pre-commit and post-merge hooks and exit, without scanning. For when status reports a missing hook.
Try it
SecretSleuth --install-hook
--install-hook is a flag on the scan command rather than a subcommand.
How it works
Installs both hooks into the repository’s hooks folder, or into core.hooksPath when one is set (husky and similar tools):
- pre-commit blocks any commit whose staged content contains
DO_NOT_COMMIT_. - post-merge checks protected files still hold their placeholders after a merge, and asks for a re-scan when one does not.
Existing hooks are never overwritten. They are renamed to <hook>.ifss-backup and still run after the Secret Sleuth check. restore --remove-hooks puts them back.
Check the result
status shows both hooks as installed. If a hook manager regenerates its folder, run this again.