论坛首页 综合技术论坛

使用apache 配置http协议的git库

浏览 1912 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2012-06-09  
使用apache 配置http协议的git库.

apache配置文件部分,git.conf

DavLockDB "/usr/local/apache/var/DavLock"

Alias /git "/home/git/gitrepo"

<Location /git>
    Allow from all
</Location>

<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: jack
testproject-write: john alex
 

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

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




论坛首页 综合技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics