git and Apache on CentOS 6.2
[root@testbed01 ~]# yum install git
[root@testbed01 ~]# mkdir /data/temp/git
[root@testbed01 ~]# cd /data/temp/git
[root@testbed01 ~]# git init --bare testrepo.git
[root@testbed01 ~]# cd testrepo.git
[root@testbed01 ~]# vi /etc/httpd/conf.d/git.conf
**** add this code ****
<VirtualHost *:80>
ServerName git.rgiapratama.net
DocumentRoot /data/temp/git/
<Directory /data/temp/git/>
DAV On
Options ExecCGI FollowSymLinks Indexes
Deny from all
AuthType Basic
AuthName "GIT"
AuthUserFile /etc/httpd/git/htpasswd.git
</Directory>
<Directory /data/temp/git/testrepo.git>
Allow from all
Order allow,deny
<Limit GET PUT POST DELETE PROPPATCH MKCOL COPY MOVE LOCK UNLOCK>
Require valid-user
</Limit>
</Directory>
</VirtualHost>
**** end code ****
** Create htpasswd file
[root@testbed01 ~]# htpasswd -c /etc/httpd/git/htpasswd.git username01
[root@testbed01 ~]# htpasswd /etc/httpd/git/htpasswd.git username02
** end create htpasswd file
[root@testbed01 ~]# chown apache:apache /data/temp/git -R
[root@testbed01 ~]# sudo -u apache git update-server-info
[root@testbed01 ~]# service httpd restart
Done…
Reference :