Skip to main content

The MHCLG Way and its content is intended for internal use by the MHCLG community.

Git Pre-commit Hooks

Git hooks are scripts that Git executes before or after events such as commit, push, and receive.

Pre-commit hooks are useful in detecting secrets automatically before developers commit work locally on their machines. MHCLG recommends a pre-commit git hook called Detect Secrets for preventing secrets being commited to git.

Github also now offers secret scanning and push protection for certain repositories.

Further guidance

This page was last reviewed on 28 July 2025. It needs to be reviewed again on 28 October 2025 by the page owner #mhclg-way .