views:

177

answers:

2

I have a local machine ("laptop") and a shared Mercurial repository on another machine ("server").

The shared repository is set up as a multi-repository as described in the Mercurial documentation using Apache, the hgwebdir.cgi script and Mercurial 1.4.

The setup works in the sense that I can browse the projects (repositories) in the web browser, I can clone and pull from the server, and I can push from the laptop when the project/repository already exists on the server.

But I cannot create a new project on the laptop (hg init, do stuff, hg commit) and push it to the shared multi-repository (hg push http://server/hg/my-new-project-name) - I get "abort: HTTP Error 404: Not Found", presumably because the directory/project repository does not exist yet.

How can I push a new project/directory structure to a Mercurial running elsewhere? I couldn't find anything in the documentation, how do you guys do it?

+2  A: 

You cannot create new remote repositories over http with the built-in functionality. Your options are to either:

  1. create with a ssh clone: `ssh clone local-repo ssh://you@remote//path/to/repo'
  2. log in to the remote repo and do a hg init where you want the repo. After that you can push to the new empty repo
  3. Use a cheesy http-creation CGI like the one I wrote here: http://ry4an.org/unblog/UnBlog/2009-09-17
Ry4an
OK. Using log-in-to-remote-and-hg-init now, but was looking for a one-step option. Thanks :)
j-g-faustus
+1  A: 

I found one more option: Skipping both http and ssh altogether and using Dropbox for shared repos.

For the one-person-multiple-computers scenario, it looks like the simplest option of the lot, and you get backups as a nice side effect.

Here is a discussion on Hacker News

j-g-faustus