Hide Your Git Directory!

It seems like one of my projects had my git repo for the entire world to see. Great if it was open sourced, but even so, it’s going to be a mess if I don’t close it up.

If you’re using Apache, this should be easy to fix:

  1. sudo nano /etc/apache2/conf-enabled/security.conf
  2. Then look for “DirectoryMatch”. Ctrl + W > type DirectoryMatch > Enter
  3. Uncomment the code and replace so that it looks like this:
    <DirectoryMatch "/\.git">
    Require all denied
  4. sudo service apache2 restart
  5. You can check if it worked by visiting your .git directory in the browser ex. https://example.com/.git/

source: David Egan

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Glenn Santos

Published by Glenn Santos

Leave a Reply