通过Smart HTTP提供代码下载/上传服务

来源:互联网 发布:阿里云新手礼包在哪里 编辑:程序博客网 时间:2024/06/05 05:16

Smart HTTP是通过激活Git(1.6.6及以后版本)自带的、名为git-http-backendcgi脚本实现的。注意,此脚本只在Apache 2.x上有效。

配置Apache2,开启git-http-backend脚本:

SetEnv GIT_PROJECT_ROOT /my_repos_root_pathSetEnv GIT_HTTP_EXPORT_ALLScriptAlias /git/ /usr/lib/git-core/git-http-backend/

现在git clone http://yourhost/repos/xxx.git应该可以检出你的xxx代码库了。但是,出于安全考虑,没有授权方式的访问不提供上传(push)服务,所以暂时还不能push你的更新到代码库中。

配置授权,开启push服务。这里以Basic授权为例:

<Location /repos/>    AuthType Basic    AuthName "Git Access"    AuthUserFile /opt/access/git.passwd    Require valid-user</Location>

当然,你也可以配置成匿名clone,授权push的工作方式,这里就不举例了。

0 0
原创粉丝点击