關於git pull 時出現 fatal refusing to merge unrelated histories的解決辦法


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-錯誤/​​​​​​​


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM