gitleaks enable: unknown command" error
Fixes gitleaks 'enable: unknown command': the enable subcommand was removed in v8, so use config-based enabling instead. Use when old docs or scripts call gitleaks enable. Not for other unknown-command errors.
TL;DR
gitleaks enable does not exist in gitleaks v8; it was a v7-era subcommand. Enable rules through the config file instead, and update any scripts that still call the old subcommand.
Error
"gitleaks enable: unknown command" errorSteps
- Check your version:
gitleaks version. Expected: v8.x, whereenablewas removed. - Find every caller of the old subcommand: search scripts and CI configs for
gitleaks enable. Expected: the full list of stale references. - Replace each with the v8 equivalent: rules are enabled by listing them in the TOML config under the rules table. Expected: config-driven behavior.
- Validate:
gitleaks detect --config [path] --source [small test dir]. Expected: no command error. - Update the docs or runbook that taught the old command. Expected: no one reintroduces it.
When to use
- The error names
enableas an unknown command. - Migrating v7 setups to v8.
When not to use
- Other unknown subcommands (check the current CLI help).
- You are intentionally on v7 (then pin the version and keep the old docs).
Tool compatibility
- Gitleaks v8; v7 kept
enable.
Variant phrasings
gitleaks: unknown command enable
Same removal.
gitleaks enable rule
Use config instead.
Why it happens
Gitleaks v8 reworked the CLI around detect and protect with config files, dropping the v7 enable/disable rule toggles.
Edge cases
- Pin the gitleaks version in CI so upgrades do not surprise you.
- Config
extendbehavior differs between versions; re-check after upgrading.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_mGETzEbo9YI46Xy-FEcg1Q
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.