背景:在本地初始化了一個Git代碼倉庫,關聯到Github上建立的倉庫,第一次執行
git pull origin master
拉取遠端分支時,出現标題上的問題(Git 2.9之後的版本才會出現此問題)。

refusing to merge unrelated histories
原因:"git merge" used to allow merging two branches that have no common base by default, which led to a brand new history of an existing project created and then get pulled by an unsuspecting maintainer, which allowed an unnecessary parallel history merged into the existing project. The command has been taught not to allow this by default, with an escape hatch "--allow-unrelated-histories" option to be used in a rare event that merges histories of two projects that started their lives independently(stackoverflow).
問題的結局方法,在
git pull origin master
後面跟上參數
--allow-unrelated-histories

解決方法
原因:“git合并”用于允許合并兩個分支沒有公共基礎在預設情況下,導緻了一個全新的曆史的一個現有的項目建立然後被拉毫無戒心的維護者,這允許一個不必要的平行曆史合并到現有的項目。突擊隊員被告知預設情況下不允許這樣做,有一個escape hatch“——allowunrelated- history”選項,用于罕見的事件,合并兩個項目的曆史,開始他們的生活獨立(stackoverflow)