fedora 16 下搭建git+apache+webdav环境
1、在apache httpd.conf配置文件添加
<Directory "/var/www/html/gitrepo">
Dav On
Options +Indexes +FollowSymLinks
AllowOverride None
Order Allow,Deny
Allow from all
AuthType Basic
AuthName "Git"
AuthUserFile "/var/www/html/user.git"
Require valid-user
</Directory>
Dav On
Options +Indexes +FollowSymLinks
AllowOverride None
Order Allow,Deny
Allow from all
AuthType Basic
AuthName "Git"
AuthUserFile "/var/www/html/user.git"
Require valid-user
</Directory>
2、将当前用户heroking加入到apache用户组,否则在push时会报权限错误。,在/etc/group文件中
heroking:x:1000:apache
3、创建dav用户及密码,如果user.git已存在,可以不加参数c
$ htpasswd -bc user.git heroking git
4、在/var/www/html/gitrepo文件夹下,初始化git资源
$ mkdir test.git
$ cd test.git
$ git init --bare
$ cp hooks/post-update.sample hooks/post-update
$ chmod a+x hooks/post-update
$ ./hooks/post-update
$ cd test.git
$ git init --bare
$ cp hooks/post-update.sample hooks/post-update
$ chmod a+x hooks/post-update
$ ./hooks/post-update
5、获取资源
$ git clone http://heroking@localhost/gitrepo/test.git