BetaDeveloper
Git hooks
Block commits and pushes that contain secrets with a Git hook installed and managed by the SonarQube CLI.
Prerequisites
Choose pre-commit or pre-push
Hook
Fires when…
What it scans
Trade-off
Install
Per repository (default)
# Pre-commit (default)
sonar integrate git
# Or explicitly:
sonar integrate git --hook pre-commit
sonar integrate git --hook pre-pushGlobally for every repository
Non-interactive install (for provisioning)
How the CLI handles existing hooks
Verify the hook
Bypass the hook
Uninstall
Related pages
Last updated
Was this helpful?

