Skip to main content

The GDS Way and its content is intended for internal use by the GDS and CO CDIO communities.

Git Pre-commit Hooks

The guidance on this page is no longer valid, and is due to be updated.

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.

The Cabinet Office Digital Cyber Security team has recommended a pre-commit git hook called Detect Secrets for preventing secrets being commited to git. This is no longer centrally managed but something that teams should customise for their local usage.

Further guidance

This page was last reviewed on 1 November 2023. It needs to be reviewed again on 1 February 2024 by the page owner #gds-way .
This page was set to be reviewed before 1 February 2024 by the page owner #gds-way. This might mean the content is out of date.