Developer
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)
# Interactive: prompts for pre-commit and pre-push separately
sonar integrate git
# Install a specific hook without prompts:
sonar integrate git --hook pre-commit
sonar integrate git --hook pre-pushGlobally for every repository
Non-interactive install
How the CLI handles existing hooks
Verify the hook
Bypass the hook
Uninstall
Related pages
Last updated
Was this helpful?

