此修复位于帖子的底部,位于灰色背景的最后一个块中。
我正在尝试将我的Raspberry Pi - 运行Debian的股票版本作为Mercurial的远程存储库。我已经在我的桌面和笔记本电脑上设置了本地存储库(运行Mageia),它们在本地工作正常。我希望能够将任何更改推送到Pi。我已经在Pi上设置了OpenVPN,因此我可以访问它,并希望能够从世界上任何地方推送和提取我的软件。
所以,我跟着these instructions:
一步一步(使用Apache2作为我的网络服务器),当我尝试按步骤9.1.2连接时:
通过将浏览器指向yourhost / hg /.
来检查它是否有效
通过将pi / hg放入Firefox,我收到内部服务器错误。 (只需将pi放入Firefox即可获得默认的Apache消息,一切都很好。)
我的Apache错误日志向我显示:
Traceback (most recent call last):
File "/var/hg/hgwebdir.cgi", line 18, in <module>
application = hgweb(config)
File "/usr/lib/python2.7/dist-packages/mercurial/hgweb/__init__.py", line 27, in hgweb
return hgweb_mod.hgweb(config, name=name, baseui=baseui)
File "/usr/lib/python2.7/dist-packages/mercurial/hgweb/hgweb_mod.py", line 34, in __init__
self.repo = hg.repository(u, repo)
File "/usr/lib/python2.7/dist-packages/mercurial/hg.py", line 93, in repository
repo = _peerlookup(path).instance(ui, path, create)
File "/usr/lib/python2.7/dist-packages/mercurial/localrepo.py", line 2350, in instance
return localrepository(ui, util.urllocalpath(path), create)
File "/usr/lib/python2.7/dist-packages/mercurial/localrepo.py", line 79, in __init__
raise error.RepoError(_("repository %s not found") % path)
mercurial.error.RepoError: repository /var/hg/repos not found
[Wed Jan 22 17:23:26 2014] [error] [client 10.8.0.6] Premature end of script headers: hgwebdir.cgi
如果我尝试从Mercurial连接到远程(http)存储库,因为pi /我在我的Apache日志中得到了这个:
[error] [client 10.8.0.6] File does not exist: /var/www/.hg
In my Tortoise HG logs on the local machine I get this:
[command returned code 255 Wed Jan 22 17:24:49 2014]
% hg --repository /path/sqlforms outgoing --quiet --template {node}URL goes here ' does not appear to be an hg repository:
---%<--- (text/html)enter code here
<html><body>
<p>This is the default web page for this server.</p>
<p>The web server software is running but no content has been added, yet. Rob has changed summat</p>
如果我使用pi / hg作为远程服务器,Tortoise HG给我这个:
[command returned code 255 Wed Jan 22 17:25:15 2014]
% hg --repository /path/sqlforms outgoing --quiet --template {node}^M http://pi/hg/
HTTP Error: 500 (Internal Server Error)
[command returned code 255 Wed Jan 22 17:25:24 2014]
sqlforms%
/ var / hg / repos确实作为目录存在。
希望我在那里给出了适量的信息。我不是Linux新手,但我是Apache,对Mercurial来说相当新,所以我可能做了一些愚蠢的事情。 AFAIK我忠实地复制了上面显示的网站链接上的步骤。是否有足够的信息进行故障排除?如果没有,我可以根据需要提供其他任何东西。非常感谢。
It ended up being a number of different things - some of which Mata mentioned, so I'm putting his/her answer down as he/she was kind enough to point me in the right direction. I'm putting some more details below in case it helps someone else because in all documentation I've found some points aren't well made.
It's important to note that the /var/hg directory that you specify ends up being accessed as server_name/hg when accessing via http. So, if you put a directory on your server in path:
/var/hg/dex
Then this is accessed via http as:
http://serve_name/hg/dex
So, in this case the http access you are "mapping" /var/hg/dex as hg/dex
I think what is super-confusing about the documentation is the way hg is used too much and it would be better described if the base directory structure on your server is something like this:
/var/mercurial_repositories
You would obviously have to set up the Apache config file to point there as its base directory rather than at:
/var/hg.
This would make it far more obvious that you are mapping /var/mercurial_repositories to hg when it comes to remote access. The way it is described it is far too ambiguous with hg being used in too many different places. Whereas this might be obvious to experienced users or someone who's had someone sit down and explain it to them, to a newb, it's very confusing.
Then, the other thing that is not obvious in the documentation is that:
/var/hg/repos
is not a directory for ALL repositories. This is a directory for one repository. I struggled with this for quite some time. Again, the documentation is very misleading for a newb. If it said:
/var/hg/repo (singular) it might be a lot better.
I realise later, tucked away somewhere in one of the pages of documentation is mentions you need subdirectories within repos, but, again, it is very confusing for someone starting out the way this is worded. Something like:
/var/mercurial/repositories_base_directory
Would be far clearer.
Also, for every directory you set up in your base directory, you have to have a new entry in the file:
/var/hg/hgweb.config
This is done like this:
[paths]
c82xx = /var/hg/repos/c82xx
The documentation on this is especially terrible the way it just says:
repos/ = repos/
The issue with these path settings, which, again is explained nowhere (as far as I could see), is that on the left hand side of the equals sign is how your remote machine accesses the directory where your repository is as a subdirectory of:
http:://server/hg
The right hand side is the absolute path on the server. It means you can type a relatively small path while remotely pushing and pulling. This instance:
http:://server/hg/c82xx
Next up, as Mata pointed out, you need to do hg init in the directory on the server, then from the local machine, push whatever you have already got to the server. So, in the directory with .hg on your local machine (in this case my c82xx project:
hg push http:://server/hg/c82xx
There are two more vital thing to note though before you can do this:
1. You need to create, within the .hg directory on the SERVER a file called hgrc and put this in it:
[web]
push_ssl = false
allow_push = *
Now, from what I understand, you should ONLY do this on a trusted network. For me, I'm on a VPN or my LAN, so it's fine.
2. That hgrc file AND all the repository directory and subdirectories have to have permissions to allow writing to these directories and folders.
That should do it. Phew!
I swear, version control is more complex than writing the software in the first place! :D
答案 0 :(得分:1)
将目录指定为config
仅当它是存储库时才有效。您将它指向一个似乎不是存储库的目录。
也许您正试图从该目录中提供多个存储库?在这种情况下,您需要将config
设置为指向配置文件,然后您可以在其中指定要包含的存储库。
看看here,它应该描述你需要的一切。