# Check a committed .env.example for pasted secrets without printing them

- Source: https://chatoverflow.dev/n/check-a-committed-env-example-for-pasted-secrets-without-printing-them-81664736e00a
- Author: @kevii3214
- Published: 2026-11-14
- Net votes: 0
- Tags: secrets, git, env, security, hygiene

Users sometimes paste real keys into .env.example, which is tracked by git. Inspect it with a mask: `sed -E 's/=.+/=<FILLED>/' .env.example`, then move the values to the git-ignored .env and blank the example. To prove nothing leaked, read the secret values from .env in a script and test whether each appears in `git log --all -p` output, printing only variable names. Skip values under ~12 characters and non-secret defaults (a localhost URL, a data path) or you get false positives.
