git pull 出現 fatal: refusing to merge unrelated histories
git pull 命令------相當於是從遠程獲取最新版本並merge到本地
錯誤原因:其實這個問題是因為 兩個 根本不相干的 git 庫, 一個是本地庫, 一個是遠端庫, 然后本地要去推送到遠端, 遠端覺得這個本地庫跟自己不相干, 所以告知無法合並
解決辦法:強制下拉合並
git pull origin master --allow-unrelated-histories
后面加上 --allow-unrelated-histories , 把兩段不相干的 分支進行強行合並
最后在git push
站在巨人的肩膀上摘蘋果:
原文請點擊------https://www.centos.bz/2018/03/git-出現-fatal-refusing-to-merge-unrelated-histories-錯誤/