简体   繁体   English

“(.hg not found)”从cygwin托管的存储库通过ssh克隆到Mac和FreeBSD客户端时

[英]“(.hg not found)” when cloning from cygwin-hosted repository via ssh to Mac and FreeBSD clients

I am running an archival filesystem on a Windows server that does automatic offsite replication which makes it the ideal place to host Mercurial repositories and be sure of their safety. 我在Windows服务器上运行存档文件系统,该服务器执行自动异地复制,这使其成为托管Mercurial存储库并确保其安全性的理想位置。 This filesystem is Windows-only so I have no choice but to use Windows as the host OS. 这个文件系统只有Windows,所以我别无选择,只能使用Windows作为主机操作系统。

Setup: 建立:

Server ('ungoliant', internal to my network): 服务器('ungoliant',我的网络内部):

  • Windows 7 master repository host machine. Windows 7主存储库主机。
  • Cygwin ssh daemon. Cygwin ssh守护进程。
  • hg 1.9.3 hg 1.9.3
  • Created new repository "/cygdrive/j/mercurial/rcstudio" on Windows with "hg init". 在Windows上使用“hg init”创建了新的存储库“/ cygdrive / j / mercurial / rcstudio”。

Clients: 客户:

  • Mac OSX 10.7.4 running hg 2.1.2 Mac OSX 10.7.4运行hg 2.1.2
  • FreeBSD 8.3 running hg 2.1.2 FreeBSD 8.3运行hg 2.1.2

Problem on Clients (identical on Mac and FreeBSD): 客户端问题(Mac和FreeBSD上相同):

$ hg clone ssh://cjp@ungoliant//cygdrive/j/mercurial/rcstudio
running ssh cjp@ungoliant 'hg -R /cygdrive/j/mercurial/rcstudio serve --stdio'
remote: abort: There is no Mercurial repository here (.hg not found)!
abort: no suitable response from remote hg!

I've confirmed that the path and the URI are correct. 我已经确认路径和URI是正确的。 There absolutely is an ".hg" directory there: 那里绝对有一个“.hg”目录:

$ ls -la
total 0
drwxr-xr-x   3 cjp  staff   102 Jun  5 17:41 .
drwxr-xr-x  41 cjp  staff  1394 Jun  5 16:30 ..
$ scp -r cjp@ungoliant:/cygdrive/j/mercurial/rcstudio/.hg .
$ ls -la
total 0
drwxr-xr-x   3 cjp  staff   102 Jun  5 17:41 .
drwxr-xr-x  41 cjp  staff  1394 Jun  5 16:30 ..
drwxr-xr-x   5 cjp  staff   170 Jun  5 17:41 .hg
$ ls -la .hg
total 16
drwxr-xr-x  5 cjp  staff  170 Jun  5 17:41 .
drwxr-xr-x  3 cjp  staff  102 Jun  5 17:41 ..
-rw-r--r--  1 cjp  staff   57 Jun  5 17:41 00changelog.i
-rw-r--r--  1 cjp  staff   33 Jun  5 17:41 requires
drwxr-xr-x  2 cjp  staff   68 Jun  5 17:41 store

I've found plenty of stackoverflow questions where the issue was an improperly formatted ssh URI ... mine is formatted correctly and describes an absolute path. 我发现了很多stackoverflow问题,其中问题是格式不正确的ssh URI ...我的格式正确并描述了绝对路径。

I have confirmed all the following: 我已经确认了以下所有内容:

  • hg commands run fine both on the server and through ssh. hg命令在服务器上和通过ssh都运行良好。
  • If I paste the absolute path I am able to confirm the existence of the .hg directory through ssh. 如果我粘贴绝对路径,我可以通过ssh确认.hg目录的存在。
  • Other hg commands manually issued through ssh succeed (eg: ssh cjp@ungoliant 'cd /cygdrive/j/mercurial/rcstudio; hg diff;'). 通过ssh手动发出的其他hg命令成功(例如:ssh cjp @ ungoliant'cd / cygdrive / j / mercurial / rcstudio; hg diff;')。
  • On the host machine I can clone locally from that same absolute path. 在主机上,我可以从同一个绝对路径进行本地克隆。

I'm stumped here. 我在这里难过。 The Mercurial docs make it sound like 2.1.2 should be able to clone from 1.9.3 parents, so it doesn't appear to be a version conflict. Mercurial文档听起来像2.1.2应该能够从1.9.3父级克隆,因此它似乎不是版本冲突。

Would very much appreciate your help! 非常感谢你的帮助! Thanks! 谢谢!

What I have ended up with is a workaround and not an answer. 我最终得到的是一种解决方法而不是答案。

My own ignorance of remote ssh command processing lead to a misunderstanding. 我对远程ssh命令处理的无知导致了误解。 If I would ssh to the machine, "which hg" resulted with the cygwin-aware binary "/usr/bin/hg", but if I did a remote command "ssh cjp@ungoliant 'which hg'", it returned the path to a windows binary I also have installed on that machine. 如果我要ssh到机器,“哪个hg”导致cygwin感知二进制文件“/ usr / bin / hg”,但是如果我做了一个远程命令“ssh cjp @ ungoliant'hg'”,它返回了路径到Windows二进制文件我也安装在那台机器上。

I played with my .bashrc file and could not get remote command execution to prioritize the cygwin binary. 我玩我的.bashrc文件,无法获得远程命令执行来优先处理cygwin二进制文件。 The PATH doesn't even include the Windows PATH entries, so I started hacking around the problem and eventually decided to stop fighting with it. PATH甚至没有包含Windows PATH条目,所以我开始讨论这个问题并最终决定停止与它斗争。

I have since abandoned the entire idea because I'm convinced that even if I get it to work it will be a delicate kludge and not at all worth the time I've spent on it. 我已经放弃了整个想法,因为我相信,即使我把它付诸实践,它也将是一个微妙的kludge,而且根本不值得我花在它上面。 I now host my repositories on a BSD box and I have a cron on the Windows machine that pulls from that repository onto the archival filesystem once every 24 hours. 我现在将我的存储库托管在BSD盒子上,并且我在Windows机器上有一个cron,它每24小时从该存储库拉到存档文件系统一次。 It's simple and worked like a charm with zero problems. 它很简单,就像一个零问题的魅力。

我有同样的问题,通过添加像这样的选项--remotecmd来解决它

hg clone --remotecmd /usr/bin/hg ssh://me@mywindowspc//cygdrive/m/hgrepo

When you attempt an scp you would do the following: 当您尝试使用scp时,您将执行以下操作:

scp username@ipaddr:/cygdrive/d/test/foo.txt ./myDestFolder

Unfortunately for hg that does not work. 不幸的是,hg不起作用。 Instead try: 而是尝试:

hg clone ssh://username@ipaddr/D:/testRepo

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM