Common problem

Is your .git folder public?

The .git folder holds your project's history. If your host serves it, tools can often rebuild your source code, including any secret that was ever committed.

Short answer: it shouldn't be public. Open https://your-site.com/.git/config in your browser. If you see text that starts with [core], your .git folder is public. Fix it today.

Check your live app for free

Paste your link. The free summary usually takes under a minute.

How it happens

The whole project folder gets deployed, instead of only the build output.

The host has no rule to block paths that start with /.git.

What our scan checks

  • We ask for /.git/config at the root of your site, with one normal request. If it opens and looks like a git config file (it contains [core]), we flag it.
  • That's the only .git file we ask for. We don't download your history or look through it for secrets.
Example fix prompt

Fix prompt from a full report

Paste this into your AI builder
In my AI app builder (Lovable, Bolt, Cursor, Replit, v0 or similar):
My /.git folder is publicly served.
1. Remove the .git folder from what my host serves (deploy the build output only).
2. Add a rule to block every path that starts with /.git.
3. Check my git history for secrets; I will rotate any I find.

The full report gives a prompt like this for every issue it finds, written for your site.

How to check

  1. Open a new browser tab.
  2. Go to https://your-site.com/.git/config (use your real address).
  3. Look at what comes back.

Good: a "not found" page (404), a "forbidden" page (403), or your normal web page.
Bad: a plain text file with [core] near the top, and maybe lines about a remote address.

Why is a public .git folder a problem?

If your site serves that folder, anyone can ask for the files in it. Tools can often rebuild your source code and history from them. That means:

  1. Your source code can be copied.
  2. Any secret that was ever saved in your code can be found, even if you deleted it later. Git keeps old versions.
  3. Your commit history shows how your app works, which can help someone look for weak spots.

Our scan rates this as high. If a key was ever committed, treat it as leaked.

How to fix it

The best fix is to stop the folder from being deployed at all: deploy only your build output (often a folder like dist or build), not your whole project. Then add a rule that blocks every path starting with /.git, as a backup. Here's how on three common hosts.

How to block .git on nginx

Add this inside the server block for your site:

location ^~ /.git {
    return 404;
}

^~ tells nginx to use this block for any path that starts with /.git, and to skip regex location blocks for those paths. (nginx: location) return 404 stops and sends a "not found" answer. (nginx: return) If you'd rather refuse access, use deny all; in place of return 404;. (nginx: deny)
This also blocks paths like /.gitignore, which is fine. Then test your config with nginx -t and load it with nginx -s reload. (nginx: command-line parameters)

Does Vercel deploy my .git folder?

Vercel's docs say the Vercel CLI never uploads a .git folder. It's on Vercel's list of files that are always left out. (Vercel: Ignored files and folders) Vercel says that list applies to CLI deploys. For deploys from GitHub or another git host, its docs don't say either way, so do the 1-minute check above.
To keep other files out of a deploy, list them in a .vercelignore file in your project root. (Vercel: .vercelignore) Also check your Output Directory. It should be your build folder, not your whole project. You can set it in Project Settings or with outputDirectory in vercel.json. (Vercel: vercel.json)

How to block .git on Netlify

Netlify's docs say only the files in your publish directory are deployed. (Netlify: Build configuration) So set the publish directory to your build folder, not the root of your repo.
As a backup, add this line to a file named _redirects in your publish directory:

/.git/*  /404.html  404!

Or put the same rule in netlify.toml:

[[redirects]]
  from = "/.git/*"
  to = "/404.html"
  status = 404
  force = true

Netlify's docs say a rule with status 404 shows a "not found" page for that path. Adding ! (or force = true) makes the rule apply even if a real file is there. (Netlify: Redirect options) Point to at a page you have, like your own 404 page. Rules in _redirects run before rules in netlify.toml, and the first match wins. (Netlify: Redirects and rewrites)

Other hosts

Look for two things in your host's settings: which folder gets published, and a way to block paths. Set the first to your build folder. Use the second to block every path that starts with /.git.

After the fix

  1. Redeploy so the new settings are live.
  2. Check again. Open /.git/config and make sure it no longer loads.
  3. Rotate any secret that was ever in your code. This means API keys, database passwords and tokens. Make new ones and turn the old ones off. Blocking the folder doesn't undo a leak that already happened.
  4. Keep secrets out of your code. Store them as environment variables on your host, and keep .env files out of git.

Exactly what the /.git/config request covers

Our scan asks for /.git/config at the root of your site, with one normal request, the same way a browser would. It follows redirects. It flags the file only if the answer is OK (200), isn't a web page, and contains [core], like a real git config file. A 404, a 403 or your normal page counts as not exposed. If the request times out or your server gives an error, the report says we couldn't check it.
The scan doesn't download anything else from .git, and it doesn't look through your history for secrets. It doesn't check .git folders in subfolders (like /app/.git), other subdomains, or other version control folders like .svn. It only sees what your site shows the public, so it can't see your server settings or tell you if a secret was ever committed.

Common questions

Can people download my .git folder?
Only if your host serves it. If /.git/config opens in your browser, assume other files in the folder can be downloaded too.

Is a public .git/config a problem on its own?
It's a sign the whole folder is being served. It also shows your remote address. If you ever saved a token in that address, treat the token as leaked.

I deleted the secret from my code. Am I safe?
Not yet. Git keeps old versions, so the secret may still be in your history. Make a new key and turn off the old one.

My scan says /.git is not exposed. Am I safe?
It means /.git/config at the root of your site didn't open when we checked. It doesn't prove there are no other leaks. Keep secrets out of your code either way.

This is an automated, surface-level check of what your site shows the public. It is not a full security audit.