How to protect .git folder using htaccess

GIT is popular version control software, this work like a time machine. You can easily get older versions of code. Each changes are stored as commit, so it work like a time machine for source code.

If you put your .git folder in a publically accessable folder, others will be able to access your source code. It is better put this folder outside of DocumentRoot folder.

If your .git folder is on public folder, then use following .htaccess code to block access to it.

Method 2

Create an .htaccess file inside .git folder with content

PHP Script to pull changes from GIT Repository

Here is a PHP script, that pull latest code from Git Repository to your web site.

git log

To see got commit log, type

To see logs in one line, run

To see one line grap, use

or

git