如何在共享主机上设置Mercurial中央存储库 [英] How to setup Mercurial central repository on shared hosting

查看:87
本文介绍了如何在共享主机上设置Mercurial中央存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用共享托管设置中央存储库.我通读本教程的所有内容 https://www.mercurial-scm.org/wiki/发布存储库无济于事.这是我采取的步骤.

I am trying to setup a central repository with shared hosting. I read all the way through this tutorial https://www.mercurial-scm.org/wiki/PublishingRepositories to no avail. Here are the steps I took.

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:未找到错误.

After going through these steps I get a 404: Not Found error.

但是,如果我将目标路径更改为 http://url.com/central_repository/projectname 它的行为就像找到了存储库,告诉我它找到了变更集,并且正在添加变更集和清单,但是随后它说:事务异常中止!HTTP错误500:内部服务器错误.

However if I change the destination path to http://url.com/central_repository/projectname It acts like it found the repository, It tells me it found the changesets, and it was adding the changesets and manifests, but then it says "transaction abort! HTTP Error 500: Internal Server Error.

感谢您的帮助!大都会

编辑

每当我尝试将ScriptAlias,Alias,先前的内容或以下的内容放入htaccess文件时,都会收到500个内部服务器错误.

Also whenever I try to put the ScriptAlias, Alias, the previous content, or the following content into an htaccess file, I get a 500 internal server error.

<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错误.

In fact, if I take everything out of the hgwebdir.cgi file except for the following, I get a 500 error.

#!/usr/bin/env python
#
# An example CGI script to export multiple hgweb repos, edit as necessary

我什至尝试将此文件放在cgi-bin目录中,但仍然出现错误.我也确保将文件权限设置为755.是否可能无法在此服务器上运行python文件?

I even tried putting this file in the cgi-bin directory and I am still getting the error. I also was sure to put the file permissions to 755. Is it possible I can not run python files on this server?

推荐答案

如果.cgi扩展名尚未映射到主机的Apache配置中的cgi处理程序,则hgwebdir.cgi脚本需要ScriptAlias或AddHandler行.实际上,如果只执行一个ScriptAlias,就可以摆脱所有不必要的RewriteCond和RewriteRule内容:

If the .cgi extension isn't already mapped to the cgi handler in your host's Apache config you either need a ScriptAlias or AddHandler line for your hgwebdir.cgi script. Actually you can get rid of all that unnecessary RewriteCond and RewriteRule stuff if you just do a single ScriptAlias:

ScriptAlias /hg /home/username/central_repository/hgwebdir.cgi

仓库也有一个/home/user/central_repository/projectname/.hg目录,对吗?将.hg的内容直接放入项目名称中将是错误的.

Also the repo has a /home/user/central_repository/projectname/.hg directory, right? Putting the contents of the .hg directly into projectname would be wrong.

最后,请尝试使用浏览器访问它,而不要使用克隆.您在 http://ggap.sf.net/hg/看到了什么? apache访问和错误日​​志中有什么?希望您可以访问错误日志,因为该错误日志始终具有调试此内容的最佳输出.

Lastly, try visiting it with your browser, not using clone. What do you see at http://ggap.sf.net/hg/ ? What is in the apache access and error logs? Hopefully you have access to the error log because that always has the best output for debugging this stuff.

这篇关于如何在共享主机上设置Mercurial中央存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆