如何使用Mercurial将存储库克隆到远程服务器/存储库

如何使用Mercurial将存储库克隆到远程服务器/存储库

问题描述:

今天发现自己对此很困惑.

Found myself quite confused today about this.

我在本地创建了一个空白存储库(hg init),将其克隆到工作副本中,添加了一些代码,提交并推送了(显然是本地存储库).

I create a blank repository locally(hg init), cloned it to working copy, added some code, commited and pushed it(to local repo obviously).

现在,我需要与他人共享该存储库.有一台服务器上有很多软件,我该如何将我的存储库克隆到一个远程存储库,以便其他开发人员可以访问它并从/向其中拉入/推送代码?

Now I need to share that repository with others. There is a server that has mercurial on it, how do I clone my repository to a remote one such that other developers can access it and pull/push code from/to it?

您将要查看

You'll want to check out the publishing repositories wiki page to get into web interfaces and access controls, but at it's most basic you can do something like this:

hg clone yourlocalrepo ssh://you@server//home/you/repo

这会将您的本地存储库克隆到您选择的远程位置.请注意,该URL中有两个双斜杠.

That clones your local repo to a remote location of your choosing. Note that there are two double slashes in that URL.

您不能像使用http://那样仅通过ssh://来创建远程仓库.如果您只有hgweb.cgi的http,则可以在服务器上"hg init"一个空的存储库,然后将其推送到它.

You can't create a remote repo like that using http://, only ssh://. If all you have is http to hgweb.cgi you can 'hg init' an empty repo on the server and then hg push to it.