全部,
这个问题我找了很久,也尝试过不同的方法。
我想仅通过 SSH 在服务器上维护我的代码。但是当我运行这个时:
sudo hg clone -v ssh://carl@hostname//home/carl/Java/Projects/peta/
Mercurial 不断告诉我远程:中止:此处没有 Mercurial 存储库(未找到 .hg)!
。有文章说路径要正确,那里应该有一个.hg
目录。但我检查了好几次,我确信在正确的位置有一个 .hg
文件夹。
我也尝试过
hg --config ui.remotecmd=/usr/bin/hg clone ssh://carl@hostname//home/carl/Java/Projects/peta/
但它也失败了。还可能是什么问题?谢谢。
<小时/>已解决
我终于解决了这个问题。之前,我在本地计算机上创建了一个存储库,并将所有文件(包括 .hg
)复制到服务器上。我尝试先删除 .hg
目录,然后通过 ssh (hg init
) 在服务器上创建一个存储库。然后hg clone
就可以工作了!
最佳答案
从 hg 帮助 url 中提取
Some notes about using SSH with Mercurial:
- SSH requires an accessible shell account on the destination machine and a copy of hg in the remote path or specified with as remotecmd.
path is relative to the remote user's home directory by default. Use an extra slash at the start of a path to specify an absolute path:
ssh://example.com//tmp/repository
这至少意味着您不能使用相同的 URI 并仅更改它的一个/两个斜杠:至少一个路径将不存在。
引用和错误消息的结果:您必须进行调试(使用任何 ssh 工具)并找到所需目录的正确路径。你可以:
- 使用 scp (f.e) 并从已知位置复制已知文件
- 在交互式 session 中通过 SSH 连接到远程主机并手动验证路径(两者?),即:ssh ...、cd ...、pwd、验证 pwd 的输出
- ...任何其他调试器
当您在登录后获得良好的路径时,您必须检查下一个失败点 - .hg dir 权限
验证这些检查点后,您将获得克隆并以了解“之前发生了什么”的形式获得一些奖励
HTH
关于Mercurial:远程:中止:这里没有 Mercurial 存储库(未找到 .hg)!,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8493733/