Exposure Small
Take the .git directory off the web
A site deployed as a git checkout carries a hidden .git folder with the whole repository. If the web server serves it, tools can download every object and rebuild the full source code and its history, including secrets that were committed once and deleted later.
Find out whether your site has this problem, and every other check, in one free scan.
Check your site freeWhy it matters
A public .git directory lets anyone download the repository object by object and rebuild the site's full source and history, including every secret that was ever committed, even ones deleted later.
How to fix
- 1 Deny every path starting with a dot in the web server config, or deploy a build artifact instead of a git checkout.
- 2 Rotate every secret that was ever committed to the repository, since its whole history may have been downloaded.
- 3 Purge those secrets from git history, then confirm /.git/HEAD and /.git/config no longer return git data.
Common mistakes
- Blocking the /.git folder listing but not the files inside it, which is all a download tool needs.
- Removing the folder but not rotating secrets that were ever committed, since the history may already be copied.
- Deploying with git pull on the server again later, which brings the folder back.
How to verify
- 1 Open https://your-site/.git/HEAD and https://your-site/.git/config and confirm both return 404 or 403.
- 2 Re-run the scan and confirm the public .git finding is gone.
- 3 Check that the deployment now ships a build without the .git folder, or that the server denies every dot path.
Related checks
Ready to see where you stand?
Scan your site and get your Engineering Score with a prioritized roadmap in under a minute, no signup required.
