1. 程式人生 > >git fatal: refusing to merge unrelated histories

git fatal: refusing to merge unrelated histories

今天在拉取遠端倉庫上的專案時出現了這個個問題

C:\Users\Administrator\Source\Repos\NewRepo>git pull https://github.com/houchuanhao/ACM.git master
From https://github.com/houchuanhao/ACM

錯誤提示如下

 * branch            master     -> FETCH_HEAD
fatal: refusing to merge unrelated histories

原因是在本地的資料夾為NewRepo,與遠端倉庫名稱不一樣

解決方案:

pull時新增 –allow-unrelated-histories

C:\Users\Administrator\Source\Repos\NewRepo>git pull origin master --allow-unrelated-histories
From github.com:houchuanhao/ACM
 * branch            master     -> FETCH_HEAD
Merge made by the 'recursive' strategy.
 README.md | 2 ++
 1 file changed, 2 insertions(+)
 create
mode 100644 README.md