Try   HackMD

HG 轉移到 GIT(中文可以轉)

tags: git

安裝 Git for Windows(Windows要,Linux不用)

  1. https://gitforwindows.org/

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

安裝 fast-export

git clone https://github.com/frej/fast-export

安裝 dependency

  1. 開啟Git Bash
pip install pip install mercurial

使用

  1. 建立本地 git 共享庫
#創建要推上去的資料夾(或是你可以先在網頁上創好,再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
cd work_git/PKI_CAPIv2
  1. 將所需HG remote 拉下至local

  2. 轉換

D:/work_git/fast-export/hg-fast-export.sh -r D:/work_HG/PKI_PKCS11 --force -e big5 --fe big5

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  1. --fe <指定的檔名編碼>

  2. --e <指定的紀錄編碼>

遇到的問題

  1. 因為編碼問題可能會發生在branch,但似乎沒有指令參數可以設定,錯誤如下:

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  1. 解法為修改hg2git.py第135行,看你的branch是什麼編碼,像我的是"元大證金",是big5,就改為big5

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

轉移結果圖

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

參考