Xeoncross Xeoncross - 1 year ago 86
Git Question

How do you hide .git project directories?

Now that I have nginx setup I need to be able to hide my

directories. What kind of rewrite would I need to stop prying eyes? And where in the
server {}
http {}
block would it go?

Answer Source
http {
  server {
    location ~ /\.git {
      deny all;

This location directive will deny access to any .git directory in any subdirectory.

Note: This location block must be before your main location block, so that it can be evaluated first.