使用apache 配置http协议的git库

来源:互联网 发布:app看漫画软件 编辑:程序博客网 时间:2024/05/21 23:52
使用apache 配置http协议的git库.

在/home/git/目录下创建gitrepo目录,
在gitrepo中创建test.git
进入test.git目录
执行
git init --bare 
mv hooks/post-update.sample hooks/post-update
./hooks/post-update

apache配置文件部分,git.conf

DavLockDB "/usr/local/apache/var/DavLock"Alias /git "/home/git/gitrepo"<Directory "/home/git/gitrepo/">    Dav On    Options +Indexes +FollowSymLinks    Deny from all    AuthType Basic    AuthName "Git"    AuthUserFile "/home/git/gitrepo/user.git"    AuthGroupFile "/home/git/gitrepo/group.git"    Require valid-user</Directory><Directory "/home/git/gitrepo/test.git/">    Allow from all    Order Allow,Deny        <Limit GET>       Require group testproject-read    </Limit>        <Limit GET PUT POST DELETE PROPPATCH MKCOL COPY MOVE LOCK UNLOCK>       Require group testproject-write    </Limit></Directory><Location /git>    SetHandler None</Location>
 
user.git 采用htpasswd生成
group.git内容如下:
testproject-read: jacktestproject-write: john alex
 

添加本地授权文件,避免每次都提示输入密码:
Win: 添加环境变量HOME=c:/user/jack
在该目录下创建文件_netrc,内容如下
machine www.gitserver.comlogin jackpassword 123456

 *unix:在~/目录添加.netrc,内容同上。




0 0
原创粉丝点击