Possible Duplicate:
Converting a Mercurial (hg) repository to Git on Windows (7)
有一个 Mercurial 存储库,我想将其转换为 Git,这是我们在工作中使用的。我安装了 Mercurial(适用于 Windows),并且已经在本地克隆了 Hg 存储库。我坚持尝试转换它。
我发现的大多数页面都假定我使用的是 Unix/Linux,而最常见的建议 hg-fast-export 似乎只适用于这些操作系统。我确实可以访问 Git Bash。我已经做到了这一点(换行以便于阅读):
$ ~/codeingit/fast-export/hg-fast-export.sh -r
~/codeinmercurial/projectiwanttoconvert
作为响应,我得到:
ImportError: No module named mercurial
我已经阅读了很多关于此的网页,再次假设我使用的是 Unix/Linux 并且为此安装了 Mercurial。
有没有人成功地将 Hg 存储库转换为 Windows 上的 Git,并且可以编写分步指南来完成此操作?
Cygwin
- 运行 setup.exe
- 选择从 Internet 安装
- 在选择包对话框中:
- 单击树顶部(所有 旁边)的安装,直到它显示默认
- 展开 Devel 子树:安装 git(从 Skip 更改为版本号)
- 在 Devel 子树中:安装 mercurial(从 Skip 更改为版本号)
- 安装 Python 子树(从默认更改为安装)
- 点击下一步
- 如果提示解决依赖关系,点击下一步
- 喝杯咖啡,看你最喜欢的电影,或者小睡一会儿
Cygwin 安装完成后,打开 bash shell 以运行以下步骤中指示的命令。 bash 的快捷方式将称为 Cygwin Terminal。
Windows 10
打开终端(bash shell)并安装fast-export:
https://github.com/frej/fast-export.git
3) Initialize new git repo and migrate mercurial repo
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
按照 here 的描述尝试添加“authors.txt”文件,包含:
<>=devnull <devnull@localhost>
命令行现在显示为:
../fast-export/hg-fast-export.sh -r /path/to/old/mercurial_repo -A ../fast-export/authors