2

I have a local mercurial repo on my desk, and I want to upload it to bitbucket, or github, so it can be viewed on the web.

So far I am stucked at the import phase, both GitHub or Bitbucket request that I provide an URL for my repo (i'd have prefer a simple path on my disk, to the repo).

I've started a local server but then the address: http://localhost:8000/Myrepo/

failed to be acceded.

I know about the tortoiseHg Hg-Git plugin and I tried to make a push git://... but it failed too.

So my first question is: how to I put my mercurial repo on the web so it can be imported ?

My second question is: what's the point of having a bitbucket / github account if I have to set an online, public, mercurial server on the web to push to them ?

What I would like is to continue to work locally, then push to bitbucket / github, without having to set up a mercurial server.

Thanks

Milan
  • 1,547
  • 1
  • 24
  • 47
  • Github is only git so you're complicating your life there (needing hg-git) where-as bitbucket does mecurial. (Re)read the instructions there, you should be able to create an empty repo and then push your existing repo to it. – Dave C Apr 09 '15 at 04:42
  • Thanks for your answer but where are those instructions located ? I was thinking of cloning my rep, instead of creating a new one, but as long as my local repo is connected to bitbucket at the end ... – Milan Apr 09 '15 at 13:18
  • For bitbucket, just create a new repo there (with the "create" menu on the top when signed in) rather than attempting to import. The repo will be empty and the overview screen you'll be dropped on will have a helpful "Command Line > I have an existing project" that gives you the commands to use to push your existing change sets into the empty repo. The result should be the same as a clone. – Dave C Apr 09 '15 at 15:20
  • Thanks it worked ! I guess I can add a hook to mercurial so everytimes I commit it execute a push to bitbucked – Milan Apr 10 '15 at 21:19
  • Zangdar, that depends on your workflow. I prefer to make whatever local commits I want (perhaps several) and only push occasionally after re-reviewing the changes. You may want to edit your local hgrc (`hg config -l`) to change `path.default` to your bitbucket URL. – Dave C Apr 10 '15 at 21:21

1 Answers1

0

Problem: You have an existing local (mercurial or git) repo and want to transfer it to bitbucket

Short answer:

  • Create a new empty(!) repository in bitbucket
  • Copy the bitbucket URL of the new empty repo
  • Push your existing old repo to the address of the new bitbucket repo

Now the bitbucket repo is overwritten with the history of your existing (old) repo.
I just tested it and it worked perfectly :-)

The detailed answer to your Problem is explained here:
https://confluence.atlassian.com/bitbucket/push-versioned-code-to-an-empty-repository-877177145.html

Michael Hutter
  • 1,064
  • 13
  • 33