Learn to keep secrets out of Git with push protection, pre-commit hooks, and Gitleaks, protect main with rulesets, sign commits, and respond to leaks.
Every other control in this module exists because of one fact: once a secret reaches a remote repository, you must assume someone has copied it.
You cannot protect what you have not named, so the team needs one shared list of what stays out of Git.
The cheapest leak is the one that never leaves the developer's laptop, so the first layer tries to stop secrets before they are pushed.
Hooks stop new leaks, but you also need to find secrets that are already in your history and catch anything the hooks missed.
Scanning finds problems. Branch rules make sure nothing reaches main without passing the checks and a second pair of eyes.
Anyone with write access can set user.email to someone else's address and make a commit look like theirs. Signing closes that gap.
Every other control in this module exists because of one fact: once a secret reaches a remote repository, you must...
You cannot protect what you have not named, so the team needs one shared list of what stays out of Git.
The cheapest leak is the one that never leaves the developer's laptop, so the first layer tries to stop secrets before...
Hooks stop new leaks, but you also need to find secrets that are already in your history and catch anything the hooks...
Scanning finds problems. Branch rules make sure nothing reaches main without passing the checks and a second pair of...
Anyone with write access can set user.email to someone else's address and make a commit look like theirs.
Leaks happen even with every layer in place. What matters is doing the steps in the right order.
You will build the four layers on a throwaway repository, trigger each one, and then delete everything.
Quick reference Common mistakes Cleaning the history before revoking the credential is the most expensive ordering...
Roles that use the skills in this module.
DevSecOps Engineer
₹12L - ₹30L a year
DevOps Engineer
₹8L - ₹22L a year
Security Engineer
₹14L - ₹35L a year
Not a software engineer sheet. Every problem comes from real DevOps, SRE, Platform and Cloud interviews, from your first script to a system you build yourself.
Open the Coding SheetNo. Git keeps every commit, so the secret stays in the history and in every clone or fork made before the deletion. Revoke the credential first, then clean the history as a second step.
Yes. Anyone can run git commit with --no-verify, or never install the hook. That is why the same scan must also run in CI as a required check that nobody can skip.
Use Gitleaks for fast checks in hooks and CI. Use TruffleHog for audits of existing repositories, because it can test whether a found secret is still active and so tells you what to rotate first.
Signing proves who made a commit, which stops impersonation. It does not prove the code is safe, so treat it as an addition to code review and branch rules, not a replacement.