使用apache 配置http协议的git库

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

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

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




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值