pre-commit hook
A Git hook that runs before a commit is created and can refuse the commit, for example when it contains something shaped like a secret.
In more detail
It is the earliest and cheapest gate, catching a likely secret before it becomes history. A developer can skip it, so the same check must also run in the central pipeline and over the full history.
Example
It is the earliest and cheapest gate, but a developer can skip it, so the course repeats the check in the central pipeline and over history.Related terms
- Git hook — A script Git runs automatically at a point in its workflow, such as pre-commit, which can stop the commit by exiting non-zero.
- secret scanning — Searching code, commits and files for credentials such as keys and tokens, ideally before they are committed.
- security gate — An automated check in a pipeline that stops a change going further when it fails, usually by exiting with a non-zero code.
Taught in
- Working With AI Coding Assistants — AI Engineering: LLM Apps, RAG & Agents
- Pre-Commit Secret Scanning with Gitleaks & Entropy — Cloud Security & DevSecOps Engineering
- Why Secrets Leak — Application Security & Threat Modeling for Engineers
- Secret Scanning — Application Security & Threat Modeling for Engineers
- How To Stop Drowning In Findings — Application Security & Threat Modeling for Engineers