无法从 http URL 克隆 mercurial 服务器

Cannot clone mercurial server from http URL

我可以通过 SSH 连接从 Mercurial 存储库克隆我的项目。

hg clone --debug ssh://user@192.168.0.4/mercurial/MyAndroidStudioProject

但是我无法通过 HTTP 连接克隆同一个项目。

hg clone --debug http://192.268.0.4:8888/MyAndroidStudioProject/

此日志后进程挂起。

using http://192.268.0.4:8888/MyAndroidStudioProject/
sending capabilities command
destination directory: MyAndroidStudioProject
query 1; heads
sending batch command
requesting all changes
sending getbundle command

我可以从网络浏览器访问此 HTTP URL,但我无法从终端和 AndroidStudio 进行克隆。我可以知道这个问题的根本原因以及如何解决吗?谢谢

您如何从服务器提供您的存储库?听起来您可能正在尝试通过常规 Apache 服务访问它,这将无法正常工作。服务器必须能够响应特定于 mercurial 的请求(如日志中的 getbundle),这需要您进行一些设置。

通过 HTTP 提供存储库的最简单方法:使用 SSH 登录到您的服务器,cd 到您的存储库并在 Mercurial 手册中键入 hg serve. This is enough to clone over HTTP, though you probably don't want to leave it running long-term-- and it will only give you read-only access. For more functionality, see the section Serving over HTTP using CGI。这听起来不像是小菜一碟,所以我的建议是找到另一种方法来完成你的工作。

Mercurial 一书在 this chapter 中详细讨论了您的选择。