regex - the - publicly exposed git

How do you hide.git project directories? (2)

Now that I have nginx setup I need to be able to hide my .git directories. What kind of rewrite would I need to stop prying eyes? And where in the server {} or http {} block would it go?

Hidden directories and files should never be web accessible. The general answer to your question is:

  location ~ /\.  { return 403; }

This denies access to .git, .svn, .htaccess and similar files in any subdirectory.