Skip to content

.tip

· one of the small things

Scan for secrets before the commit exists

Once a key is in git history, it's in every clone and every fork, and rotating it is the only fix. A pre-commit hook catches it while it's still just a file.

# .pre-commit-config.yaml or a lefthook entry
gitleaks protect --staged

Turn on the host's push protection too, as a second net. The first net is on the laptop, before anything gets pushed.

securitygit