Windows 下搭建 Git Server

参考 http://www.devbean.info/2011/10/apache-git-server-on-windows/

用 Apache + mysysGit

第一步:安装 mysysGit , Tortoise Git (略)

第二步:安装 Apache Http Server (略)

第三步:配置 Apache

----编辑 httpd.conf

修改:

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Allow from all
</Directory>


# Set this to the root folder containing your Git repositories.
# 指定 Git 版本库的位置

SetEnv GIT_PROJECT_ROOT "F:/Git_Repo"


# Set this to export all projects by default (by default,
# git will only publish those repositories that contain a
# file named "git-daemon-export-ok"
# 该目录下的所有版本库都可以透过 HTTP(S) 的方式存取
SetEnv GIT_HTTP_EXPORT_ALL


# Route specific URLS matching this regular expression to the git http server.
# 令 Apache 把 Git 相关 URL 导向给 Git 的 http 处理程序
ScriptAliasMatch \
"(?x)^/git/(.*/(HEAD | \
info/refs | \
objects/(info/[^/]+ | \
[0-9a-f]{2}/[0-9a-f]{38} | \
pack/pack-[0-9a-f]{40}\.(pack|idx)) | \
git-(upload|receive)-pack))$" \
"D:/Program Files/Git/libexec/git-core/git-http-backend.exe/$1"

<Location /git>
AuthType Basic
AuthName "GIT Repository"
# 指定用户名密码文件的位置
AuthUserFile "D:/Program Files/Git/htpassword" 

Require valid-user
</Location>



第四步:创建用户

使用命令提示符来到 Apache 的 bin 目录,执行:

htpasswd -cmbfilename username password

生成一个名为 filename 的用户名密码文件,拷贝到 http.conf 中指定的路径



第五步:测试

1、来到目录 F:/Git_Repo下,创建版本库

    可以在 cmd 中执行 git -init --bare testrepo; 或者用 TortoiseGit 右键创建

2、用 TortoiseGit clone 版本库,http://localhost/git/Test_repo

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值