.env and .git files served publicly
If yourapp.com/.env or yourapp.com/.git/config opens in a browser, your secrets or your code's full history are public. It happens when a host serves the whole project folder, dotfiles included. The fix: rotate every exposed secret, keep dotfiles out of what you deploy, and confirm both paths return 404.
Where it shows up: Any host (most common with custom servers and misconfigured static hosting)
Are you affected? The 60-second check
Ask your live site for both files and look at the status code:
404 or 403 is what you want. A 200 isn't proof on its own: single-page apps answer every path with their homepage. Open the URL and look. Lines like KEY=value, or a [core] section, mean the file is exposed.
What it is
A .env file holds your secrets. A .git folder holds your code's full history, including files you deleted and secrets you committed by accident.
Neither should ever be part of a deployed site, but some build and hosting setups copy the whole project folder, dotfiles included.
How often we see it
We ran Shippable's static checks on about 25,000 public GitHub repos built with five AI tools (October 2026). Each figure is the share of that builder's repos where the check fired at least once. A dash means we saw it in under 1% of that builder's repos. Full method and breakdown: Which AI builder ships the safest apps?

What an attacker sees
If yourapp.com/.env loads, every secret in it is public. If yourapp.com/.git/config loads, the rest of the repository can often be rebuilt from the same folder.
How to fix it
Paste this into your AI tool:
My deployed app is serving .env or .git files publicly. Make sure these files are never included in the production build or deploy output (exclude them in the build config and block dotfiles at the host or CDN), and confirm the paths return 404 after redeploy. I will rotate any exposed secrets myself.
Or by hand:
- Rotate every secret that was in the exposed file.
- Exclude dotfiles from your deploy output, and block them at your host or CDN.
- Redeploy, check that /.env and /.git/config return 404, then re-scan.
Vercel and Netlify
These serve only your build output, so this is rare. It happens when the publish directory is set to the project root instead of dist, build or out.
Your own server (nginx, Apache, Docker)
Point the web root at the build output folder, not the project folder, and deny dotfiles. In nginx: location ~ /\.(?!well-known) { deny all; }
.env committed to git
A different route to the same leak: if your repo is public, a committed .env is readable by anyone. It's the most common finding in Lovable repos (28% in our scan). Deleting the file doesn't remove it from history, so rotate the keys.
Mistakes that look fixed but aren't
- Deleting the file from the server without rotating the secrets. Assume they were copied.
- Adding .env to .gitignore after it was committed. Earlier commits still contain it.
- Blocking /.env but not /.env.local, /.env.production or /.git/HEAD.
Check your app
Shippable requests a short, fixed list of paths: /.env, /.env.local, /.env.production and /.git/config. It confirms the response is really that file, not your app's normal page.
This check depends on your host, so scan your deployed app:
Or scan your live app in the browser:
FAQ
Does .gitignore stop my .env from being deployed?
.gitignore keeps a file out of git. Whether your host serves it depends on what you upload and which folder is the web root, so check the live URL.
Why is an exposed .git folder so bad?
From /.git/ an attacker can often download your whole repository, including old commits with secrets you've since deleted.
I committed .env to a public GitHub repo. What now?
Rotate every key in it first. Rewriting git history is optional cleanup; the old keys must be treated as stolen either way, because bots scan public repos for secrets within minutes.