如何将私有Mercurial存储库移至中央服务器? [英] How do I move a private Mercurial repository to a central server?
问题描述
我刚刚开始使用Mercurial,并且阅读了Joel Spolsky的 Hg初始化教程,我喜欢的.
I’m just getting started with Mercurial, and I’ve read Joel Spolsky’s Hg Init tutorial, which I liked.
我想知道:假设我有一个私有存储库,并且在该存储库上工作了大约一个月.然后,我决定要集中化它还是将其公开,例如在 bitbucket.org 上.我想保留所有历史.
I’m wondering: let’s say I have a private repository and I work on it for about a month. Then I decide I want to centralize it or make it public, like on bitbucket.org. I want to retain all the history.
直观的做法是使用 hg克隆,但根据到文档:
The intuitive thing would be to use hg clone, but according to the docs:
源的位置已添加到 新存储库的.hg/hgrc文件,如 将来使用的默认值 拉.
The location of the source is added to the new repository's .hg/hgrc file, as the default to be used for future pulls.
我认为这不是我想要的,因为源是我的本地私有存储库,而目标是公共服务器.我不希望公共服务器将来尝试从我的私有存储库中提取,而认为它是中心存储库.我希望这是有道理的.
I don’t think this is what I’d want, since the source is my local, private repository, and the destination is the public server. I don’t want the public server trying to pull from my private repository in the future thinking it’s the central one. I hope this makes sense.
我是否必须手动调整服务器上的.hg/hgrc文件?我能正确处理吗?
Do I have to tweak the .hg/hgrc file on the server manually? Am I approaching this correctly?
推荐答案
BitBucket's help says it's as easy as making an empty repo on BitBucket, then pushing to it:
...通过创建存储库"页面创建一个新的空存储库.我们将假定此存储库名为blonk,可在 http://bitbucket.org/jespern/blonk <上找到/a>.
... create a new empty repository via the "Create repository" page. We will assume that this repository is named blonk and is to be found on http://bitbucket.org/jespern/blonk.
现在,只需按一下即可:
Now, just push to it:
$ cd ~/Work/blonk # our existing hg repository
$ hg push http://bitbucket.org/jespern/blonk
...
完成!
您可以在存储库中编辑.hg/hgrc以包含Bitbucket的默认路径:
You can edit .hg/hgrc in your repository to include the default path to Bitbucket:
$ cat .hg/hgrc
[paths]
default = http://bitbucket.org/jespern/blonk
现在,您只需输入hg push和hg pull即可,而不必指定完整的URL.
Now you can simply enter hg push and hg pull without having to specify the full URL.
这篇关于如何将私有Mercurial存储库移至中央服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!