我正在尝试设置一个具有共享托管的中央存储库。我从头到尾读完了本教程 https://www.mercurial-scm.org/wiki/PublishingRepositories无济于事。这是我采取的步骤。
1. Copy hgwebdir.cgi file to directory at http://url.com/central_repository/hgwebdir.cgi
2. Added the following information to the hgweb.config file and copied it to same place.
[paths]
projectname = /home/username/central_repository/projectname
[web]
baseurl = /hg
3. Added the following to an htaccess file and copied it to the same place
# Taken from http://www.pmwiki.org/wiki/Cookbook/CleanUrls#samedir
# Used at http://ggap.sf.net/hg/
Options +ExecCGI
RewriteEngine On
#write base depending on where the base url lives
RewriteBase /hg
RewriteRule ^$ hgwebdir.cgi [L]
# Send requests for files that exist to those files.
RewriteCond %{REQUEST_FILENAME} !-f
# Send requests for directories that exist to those directories.
RewriteCond %{REQUEST_FILENAME} !-d
# Send requests to hgwebdir.cgi, appending the rest of url.
RewriteRule (.*) hgwebdir.cgi/$1 [QSA,L]
4. Uploaded the repository without the working directory to /home/user/central_repository/projectname
5. Tried to clone the repository to my computer using the folloing destination path: http://url.com/hg/projectname
完成这些步骤后,我收到 404:未找到错误。
但是,如果我将目标路径更改为 http://url.com/central_repository/projectname它的行为就像它找到了存储库,它告诉我它找到了变更集,并且正在添加变更集和 list ,但随后它说“事务中止!HTTP错误500:内部服务器错误。
感谢您的帮助!大都会
编辑
此外,每当我尝试将 ScriptAlias、Alias、之前的内容或之后的内容放入 htaccess 文件中时,都会收到 500 内部服务器错误。
<Directory "/home/username/central_repository/projectname">
DirectoryIndex index.cgi
AddHandler cgi-script .cgi
Options ExecCGI
Order allow,deny
Allow from all
</Directory>
事实上,如果我从 hgwebdir.cgi 文件中取出除以下内容之外的所有内容,则会收到 500 错误。
#!/usr/bin/env python
#
# An example CGI script to export multiple hgweb repos, edit as necessary
我什至尝试将此文件放入 cgi-bin 目录中,但仍然收到错误。我还确定将文件权限设置为 755。是否有可能我无法在此服务器上运行 python 文件?
最佳答案
如果 .cgi 扩展名尚未映射到主机 Apache 配置中的 cgi 处理程序,则您的 hgwebdir.cgi 脚本需要 ScriptAlias 或 AddHandler 行。实际上,如果您只执行一个 ScriptAlias,您就可以摆脱所有不必要的 RewriteCond 和 RewriteRule 内容:
ScriptAlias /hg /home/username/central_repository/hgwebdir.cgi
该存储库还有一个/home/user/central_repository/projectname/.hg 目录,对吗?将 .hg 的内容直接放入项目名称中是错误的。
最后,尝试使用浏览器访问它,而不是使用克隆。你在 http://ggap.sf.net/hg/ 看到了什么? ? Apache 访问和错误日志中有什么内容?希望您能够访问错误日志,因为它始终具有调试此内容的最佳输出。
关于mercurial - 如何在共享主机上设置 Mercurial 中央存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2484151/