Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import a Bitbucket project into Github on Windows [duplicate]

I have a HG project hosted on Bitbucket, and I want to move it to Github.

I have followed the guideline here to install hg-git extension, on my TortoiseHG.

I have created a repository on Github, but have not initialized it yet (it displays that instruction page), so I can't clone that git repository.

What do I go next?

EDIT: Sorry forgot to add that I will then use git from then on.

UPDATE: I borrowed a mac and converted it using fast-git-import painlessly. If anyone tried the solutions below and worked under Windows, vote it up enough, and I'll make it the answer.

like image 351
lulalala Avatar asked Feb 20 '12 12:02

lulalala


2 Answers

Just found out my question is a duplicate of Converting a Mercurial (hg) repository to Git on Windows (7).

It works well. Since it is all under Cygwin there is no need to use pageant.

In addition to the answer to that question. I just need to generate a key under Cygwin using ssh-keygen -t rsa. I then copied the content of public key in .ssh/id_rsa.pub to Github repository setting.

I set the git origin to the Gihub address by git remote add origin (repo address). Then finally I can git push origin master --force onto Github.

like image 92
lulalala Avatar answered Sep 21 '22 15:09

lulalala


You should complete the hg-git process (like an hg gexport) locally on your workstation.

Then, when you have a git repo mirroring your initial Hg repo, then you can add a GitHub origin, and push to it:

git remote add origin https://github.com/user/yourProject.git
git push origin master
git push --all

However, Lazy Badger comments, and rightly so, that the OP might want to only use Mercurial for this process, and not install Git at all.

In which case, the page "hg-git on GitHub" contains:

If you are starting from an existing Hg repository, you have to setup a Git repository somewhere that you have push access to, add it as default path or default-push path in your .hg/hgrc and then run hg push from within your project.
For example:

$ cd hg-git # (an Hg repository)
$ # edit .hg/hgrc and add the target git url in the paths section
$ hg push

This will convert all your Hg data into Git objects and push them up to the Git server.

like image 38
VonC Avatar answered Sep 18 '22 15:09

VonC