.gitignore secrets checker
Paste a .gitignore and see which common secret files it does not cover: .env, private keys, terraform.tfstate, cloud credentials and more, with why.
Checked as you type. Nothing you paste leaves this page.
The file is read in your browser. It is not uploaded.
Everything you type here stays in your browser. Nothing is sent to HardenKit or to anyone else.
How to use the .gitignore secrets checker
- Paste your .gitignore, drop the file, or load the example.
- Add the suggested pattern for each file type your project could contain.
- Check negated patterns (!): keep them for example files only.
- Run git ls-files to see whether any of these files are already tracked.
About this tool
Most leaked credentials on GitHub were not pasted into code. They were files: a .env, a private key, a Terraform state file, a service account JSON, swept into a commit by git add . because nothing told git to leave them out. A .gitignore is the cheapest control against that, and it is easy to get subtly wrong.
This checker applies your patterns the way git does and tests them against the files that most often hold secrets. It follows the rules of gitignore(5): the last matching pattern decides, an exclamation mark re-includes, a pattern with a slash is anchored, a trailing slash matches directories only, and a file cannot be re-included once its directory is excluded.
So it catches the cases a quick read misses: /.env that ignores the root file but not apps/api/.env, a .env rule that leaves .env.production tracked, a negation that puts a real secret back. It checks a fixed list of well-known names, so add your own project’s secret files too. It cannot see your repository.
Sources
Questions
No. Ignore rules apply only to untracked files. A file that is already tracked stays tracked until you run git rm --cached on it, and its earlier versions stay in history. If it held secrets, rotate them.
A pattern without wildcards matches that exact name. .env matches only files called .env, not .env.production or .env.local. Add .env.* (or .env*) and, if you keep an example file, re-include it with !.env.example.
A pattern with no slash matches at any depth, so .env covers apps/api/.env too. A leading slash anchors the pattern to the directory of the .gitignore file, so /.env covers only the one at the top. In a monorepo that difference decides whether nested secrets are tracked.
Terraform state records every attribute of every resource in plain text, including generated passwords, private keys and tokens. Keep state in a remote backend with encryption and access control, and ignore *.tfstate and *.tfstate.* locally.