If your deploy copies the whole project folder to a web server, the .git directory can come along. Anyone who requests https://yourapp.com/.git/config may then download your repository history, including old commits that contained API keys, database passwords or .env files you later deleted.
How to check your own site
- Open
https://yourapp.com/.git/HEADin a browser. If you see text likeref: refs/heads/main, the folder is exposed. A 404 or 403 is what you want. - Do the same for
/.git/config,/.env,/.env.productionand/backup.zip. - With curl:
curl -s -o /dev/null -w "%{http_code}\n" https://yourapp.com/.git/HEAD
Only check sites you own.
Why it happens in AI-built projects
- Deploy scripts that rsync or scp the project root.
- A Docker image built with
COPY . .and no.dockerignore. - Static hosting pointed at the repo root instead of a build output folder like
distorpublic. - Single-page apps with a catch-all rule that serves files from the wrong directory.
Fix
- Deploy only the build output, not the project root.
- Add
.git,.env*and backup files to.dockerignore. - Block dotfiles at the server: in nginx,
location ~ /\. { deny all; }. - If it was exposed, assume secrets in history are compromised. Rotate every key that ever appeared in a commit, then clean the history.
Check your own app from the outside, free. Run the free ProofForge scan on your live URL. No account needed for the first scan. It looks at your public site the way a stranger would and says pass, fail or inconclusive, so you know what is confirmed and what it could not see. One-time reports start at $9: see pricing. Building with an AI agent? There is an MCP server so it can check before it deploys.
Top comments (0)