Skip to content
All rules

ENV-COMMITTED

.env file committed to the repository

Severity
Info / Critical
Confidence
High
Stack
Secrets
Runs
On by default

What the CLI looks for

.env files tracked in the repository, classified by the kind of key they contain.

Why it matters

Anything committed stays in the git history, even after the file is deleted. If the file holds secret keys, treat them as leaked.

How to fix it

Rotate every secret that was in the file, stop tracking it, ignore it and keep an .env.example without values.

git rm --cached .env
printf '.env*\n!.env.example\n' >> .gitignore