How to import a Bitbucket project into Github on Windows [duplicate]
-
28-10-2019 - |
Question
This question already has an answer here:
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.
Solution
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.
OTHER TIPS
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 runhg 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.
In assumption, that base VCS is still Mercurial and tool - TortoiseHG
- You have to have ready Git-repo (empty, pushable from local)
- If you have added and working (i.e configured properly - can pull|push with Github) hg-git, you have to add Git-URL into (local) repo hgrc ([paths] section)
- add OpenSSH keys to Github, verify key-based authorisation in THG (pageant)
- AFAIK, only
git+ssh://git@github.com/user/repo.git
URL works for github from hg-git
- AFAIK, only
- After it you'll have two remote linked repo, for both you'll be able to push/pull from Synchronize tab
Addons
Relevant parts from mercurial.ini, git and github related
[ui]
...
ssh = "...\TortoisePlink.exe"
...
[auth]
github.com.prefix = github.com
github.com.username = lazybadger
Can say nothing about last section, just recall nothing for "when" and "why"