Pushing a local mercurial repository to a remote server or cloning at server from local

13,188

Solution 1

what am I doing wrong as far as hg serve is concerned?

Hard to say, but hg serve isn't normally the way I would to create a remote clone at a 3rd party service. For me, I wouldn't poke a hole in my firewall if I don't have to.

creating an empty repository at the server and then pushing a local repository to the new remote repository ok?

Yes. This is how I create a remote clone at Kiln. Create a new empty repo at Kiln, grab the URL for the new repository, and then push to it from my computer.

Is that the source of the searching for changes problem?

Not sure, but this report suggests that a really large push can be a problem. They suggest pushing in smaller chucks (e.g. a few revs at a time). Another consideration is whether you can live without your revision history (are you okay with creating a new repo from the current version of the files and push that repository. The report also suggests that authentication was the source of some problems (but that seemed to be a different error message).

Otherwise, you'll need to do more debugging to try to isolate the problem to this specific repo, your connectivity to the remote, or the remote repo . Some thoughts:

  1. Sounds like you already tried a different host, but perhaps try one more?
  2. Can you push an empty repository or a different repo from your machine to the remote?
  3. Do you have access to another from machine/network (e.g. a laptop and a local coffehouse with free wifi) that you can try to push the target repo or a test repo?

Solution 2

Yes, you can push to an empty repository with no problem. When you push or pull, then Mercurial will check to see if the source and destination repositories are related to each other. That prevents me from pulling changesets related to, say, OpenOffice into my clone of Mozilla Firefox.

A new, empty repository is related to all repositories, so you can always make an empty repository and push/pull changesets into it.

In fact, when you do

hg clone http://example.net/my-repository

then that is the same as doing

hg init my-repository
cd my-repository
hg pull http://example.net/my-repository

except that there wont be a default path setup for you -- see the comment by barjak for how to do that.

Solution 3

Hg Mercurial can be used with the secure shell protocol. There are two path variants:

$ hg clone localrepo ssh://[email protected]:port/relative_remote_path
$ hg clone localrepo ssh://[email protected]:port//absolute_remote_path

Solution 4

People need to know it fine (and easiest) just to init a new repo and push to it as the accepted answer says.

But another option if your server is ssh accessible would be to make a quick reverse tunnel with putty on the windows local. It doesn't require changing your firewall.

in putty look for ssh >> tunnels it the menu and chose the remote button for a reverse tunnel.

Or on a linux local something like:

ssh -fnNTR <any port you want to forward to your remote>:localhost:<port for local hg serv> <and then here type what you would normally to ssh to your remote ssh sever>

You have now bypassed your firewall and can clone!

I should add you can do a normal forward tunnel for pushing to just by change R to L (local) and changing the port numbers if ness.

Share:
13,188
Samaursa
Author by

Samaursa

Updated on June 04, 2022

Comments

  • Samaursa
    Samaursa about 2 years

    I have a local repository that I have now decided to push to a remote server (for example, I have a host that allows mercurial repositories and I am also trying to push to bitbucket). The repository has a lot of files and is a little more than 200mb. Locally, I am able to clone the repository without problems.

    Now I have a lot of changes in this repository, and I have wasted a couple of days trying to figure out how to get the remote server to clone my repository. I cannot get hg serve to work outside of the LAN. I have tried everything. So instead, I created a new repository at the remote servers (both at the host and bitbucket) with nothing in it. Now I am pushing the complete repository that I have locally to these remote locations. So far it has been unsuccessful, as the push operation is stuck on searching for changes and does not give me any other useful output. I have let it go for about an hour with no change.

    Now my questions is, what am I doing wrong as far as hg serve is concerned? I can access it locally but not remotely (through DynDns - I have configured it properly and the router forwards the ports correctly) so that I can get the server to clone the repository the first time after which I will be pushing to it. My second question is, assuming the clone at server does not work (for example, if I was to push my current repository to bitbucket), is creating an empty repository at the server and then pushing a local repository to the new remote repository ok? Is that the source of the searching for changes problem?

    Any help in this regard would be greatly appreciated.