How do I prevent apache from serving the .git directory?

Posted by Shoan on Server Fault See other posts from Server Fault or by Shoan
Published on 2010-03-31T12:11:46Z Indexed on 2010/03/31 12:13 UTC
Read the original article Hit count: 302

Filed under:
|

I have started using git for deployment of websites for testing. How do I prevent apache from serving the .git directory contents?

I tried

<Directorymatch "^/.*/\.svn/">
Order deny,allow
Deny from all
</Directorymatch>

with no success.

I know that I can create a .htaccess file in each .git directory and deny access, but I wanted something I could put into the main config file that makes this global across all websites.

© Server Fault or respective owner

Related posts about apache

Related posts about git