Possible Duplicate:
Converting a Mercurial (hg) repository to Git on Windows (7)
There's a Mercurial repository that I want to convert to Git, which is what we use at work. I have Mercurial (for Windows) installed, and I've already cloned the Hg repository locally. I'm stuck on trying to convert it.
Most of the pages I've found assume that I'm using Unix/Linux, and the most common recommendation, hg-fast-export, seems to work only in those OSes. I do have access to the Git Bash. I've gotten as far as this (line-wrapped for easier reading):
$ ~/codeingit/fast-export/hg-fast-export.sh -r
~/codeinmercurial/projectiwanttoconvert
In response, I get:
ImportError: No module named mercurial
I've read a number of web pages about this which, again, assume that I'm using Unix/Linux and that I have Mercurial installed for that.
Is there anyone who's successfully converted an Hg repository to Git on Windows, and can write a step-by-step guide to doing it?
hg-github is a Mercurial extension that wraps hg-git, and supports a work-flow where repositories are hosted on Bitbucket and mirrored on GitHub. This work-flow normally requires adding Git paths to each repository's config file, and creating Mercurial bookmarks pointing to the GitHub repository's branch name.
Jonathan: Removing it is quite proper. We try to keep simple things simple in Mercurial: hg init creates . hg for you, and rm -r . hg will undo that.
The Hg-Git plugin can convert commits/changesets losslessly from one system to another, so you can push via a Mercurial repository and another Mercurial client can pull it. In theory, the changeset IDs should not change, although this may not hold true for complex histories. Commands.
Cygwin
After the Cygwin installation is complete, open a bash shell to run the commands indicated in the steps below. The shortcut to bash will be called Cygwin Terminal.
Windows 10
Open terminal (bash shell) and install fast-export:
https://github.com/frej/fast-export.git
mkdir new_git_repo cd new_git_repo git init ../fast-export/hg-fast-export.sh -r /path/to/old/mercurial_repo git checkout HEAD
Potential Error
fatal: Invalid raw date "<devnull@localhost> xxx -xxxx" in ident: <><devnull@localhost> xxx -xxxx
Try adding an "authors.txt" file as described here, containing:
<>=devnull <devnull@localhost>
The command line now reads:
../fast-export/hg-fast-export.sh -r /path/to/old/mercurial_repo -A ../fast-export/authors
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With