有一个可能的重复项:
在 Windows 上将 Mercurial (hg) 存储库转换为 Git (7)
Mercurial 存储库,我想将其转换为 Git,这是我们在工作中使用的存储库。 我已经安装了Mercurial(适用于Windows),并且我已经在本地克隆了Hg存储库。 我一直在尝试转换它。
我找到的大多数页面都假设我使用的是Unix/Linux,而最常见的建议hg-fast-export似乎只适用于这些操作系统。 我确实可以访问 Git Bash。 我已经做到了这一点(换行以便于阅读):
$ ~/codeingit/fast-export/hg-fast-export.sh -r
~/codeinmercurial/projectiwanttoconvert
作为回应,我得到:
导入错误:没有名为 mercurial 的模块
我已经阅读了许多关于此的网页,这些网页再次假设我正在使用Unix/Linux并且为此安装了Mercurial。
有没有人在Windows上成功地将汞存储库转换为Git,并且可以编写分步指南?
1)在Windows 10上安装Cygwin或Bash
。天鹅座
- 运行安装程序.exe
- 选择从互联网安装
- 在"选择包"对话框中:
- 单击树顶部的"安装"(在"全部"旁边),直到显示"默认"
- 展开 Devel 子树:安装 git(从 Skip 更改为版本号)
- 在 Devel 子树中:安装 mercurial(从"跳过"更改为版本号) 安装
- Python 子树(从默认更改为安装)
- 单击下一步
- 如果系统提示解析依赖关系,请单击"下一步"
- 喝杯咖啡,看自己喜欢的电影,或者小睡一会儿
Cygwin 安装完成后,打开一个 bash shell 以运行以下步骤中指示的命令。bash的快捷方式将被称为Cygwin Terminal。
视窗 10
- 在 Windows 10 上安装 Bash(英语:Bash )
- 喝杯咖啡
- 打开 Bash 并键入以下内容:
- sudo apt install git
- 须藤APT安装水银
2) 安装快速导出
打开终端(bash shell)并安装快速导出:
https://github.com/frej/fast-export.git
3) 初始化新的 git 存储库并迁移汞存储库
姆克迪尔new_git_repo 光盘new_git_repo git init ../fast-export/hg-fast-export.sh -r/path/to/old/mercurial_repo git 结帐头
潜在错误
fatal: Invalid raw date "<devnull@localhost> xxx -xxxx" in ident: <><devnull@localhost> xxx -xxxx
尝试添加"authors.txt"文件,如下所述,其中包含:
<>=devnull <devnull@localhost>
命令行现在显示:
../fast-export/hg-fast-export.sh -r /path/to/old/mercurial_repo -A ../fast-export/authors