通过收集各个角落的信息位和字节,我想总结一下使用 Apache 设置带有身份验证功能的 Mercurial 服务器的步骤。
我安装Mercurial-1.9.1.win-amd64-py2.6.exe
添加以下内容C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf\httpd.conf
# Some comment so that you can find these settings later
ScriptAliasMatch ^/hg(.*) "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/hg/hgwebdir.cgi$1"
<Directory "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/hg">
Options ExecCGI FollowSymLinks
AuthType Basic
AuthName "AuthName for Mercurial"
AuthUserFile "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/hg/passwd.txt"
<Limit GET POST>
require valid-user
</Limit>
</Directory>
创建以下4个文件
C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\hg\hgwebdir.cgi(下载自http://makinggames.ca/wp-content/uploads/2010/05/hgwebdir.txt并将其重命名为 hgwebdir.cgi)
C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\hg\hgweb.config包含以下内容。
[paths]
dummy1 = d:/mercurial-repo/dummy1
dummy2 = d:/mercurial-repo/dummy2
c:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\hg\passwd.txt(请参阅本指南http://sniptools.com/vault/windows-apache-and-htaccess-authentication)
c:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\hg.htaccess(只需将文件留空即可)
初始化存储库
D:\mercurial-repo\dummy0
D:\mercurial-repo\dummy1
这可以使用 TortoiseHg 来完成,通过应用“在此处创建存储库”,通过右键单击文件夹D:\mercurial-repo\dummy0 and D:\mercurial-repo\dummy1
通过访问 Mercurialhttp://your-server:81/hg/