How do I move a private Mercurial repository to a central server?

前端 未结 2 1470
孤街浪徒
孤街浪徒 2021-02-05 17:22

I’m just getting started with Mercurial, and I’ve read Joel Spolsky’s Hg Init tutorial, which I liked.

I’m wondering: let’s say I have a private repository and I work on

2条回答
  •  后悔当初
    2021-02-05 17:44

    Doing this operation using 'hg push', as described, is probably the best way to do this, overall.

    However in other circumstances it might be convenient, or reassuring, to note that all of the Hg state is contained within the .hg directory, and so simply moving this directory is enough to move the repository.

    For example, if you have ssh access to a machine at example.com, you can tar (or zip) up your .hg directory in the 'private' repository, unpack it in, say, ~/repo/foo on the remote machine (thus creating a directory ~/repo/foo/.hg there), and then simply clone this:

    $ hg clone ssh://example.com/repo/foo
    

    This does have a slight back-door feel to it, I agree. However, there's nothing really under-the-hood happening here, and no editing of configuration files is necessary. When I do this, I find it less confusing than the 'proper' way.

提交回复
热议问题