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