HG 轉移到 GIT(中文可以轉) === ###### tags: `git` ## 安裝 Git for Windows(Windows要,Linux不用) 1. https://gitforwindows.org/ ![](https://i.imgur.com/lwa6r7w.png) ## 安裝 fast-export ```sh= git clone https://github.com/frej/fast-export ``` ## 安裝 dependency 1. 開啟Git Bash ```sh= pip install pip install mercurial ``` ## 使用 1. 建立本地 git 共享庫 ```sh= #創建要推上去的資料夾(或是你可以先在網頁上創好,再pull下來) mkdir repo-git # or whatever cd repo-git git init hg-fast-export.sh -r <local-repo> #實際的轉換指令 git checkout <branch> #切換至某個branch git push ``` ## 範例 1. 移至所需轉換的git local ```sh= cd work_git/PKI_CAPIv2 ``` 2. 將所需HG remote 拉下至local 3. 轉換 ```sh= D:/work_git/fast-export/hg-fast-export.sh -r D:/work_HG/PKI_PKCS11 --force -e big5 --fe big5 ``` ![](https://i.imgur.com/vAI7sTF.png) 2. -\-fe <指定的檔名編碼> 3. -\-e <指定的紀錄編碼> ## 遇到的問題 1. 因為編碼問題可能會發生在branch,但似乎沒有指令參數可以設定,錯誤如下: ![](https://i.imgur.com/KwVqtNq.png) 2. 解法為修改hg2git.py第135行,看你的branch是什麼編碼,像我的是"元大證金",是big5,就改為big5 ![](https://i.imgur.com/x42rKrv.png) ## 轉移結果圖 ![](https://i.imgur.com/LWmtSZN.png) ### 參考 * [來源](https://github.com/frej/fast-export) * [問題](https://www.edureka.co/community/52722/unicodedecodeerror-codec-decode-position-invalid-start-byte)