How to protect the git respository for a public_html folder on a Linux server?
On a Linux server, if you leave the .git folder unprotected in the public_html folder, its possible that someone could download the folder and then gain access to your files.
There are two ways I have seen of preventing this,
- Move it up one level and then in the .gitignore ignore all folders except the public_html.
- Deny access in the .htaccess.
Is there a better way of protecting the .git folder?