git pull倉庫報錯:refusing to merge unrelated histories

一、問題出現:

本地新建項目並編寫代碼,然後在github上新建倉庫(初始化了readme),想將本地代碼上傳一些列操作如下:

git init

git remote add xxx url

git add .

git commit -m"init"

git pull xxx master
 

此時就出現了報錯:refusing to merge unrelated histories

 

二、解決:

git pull xxx master --allow-unrelated-histories

注意:此時可能會出現衝突(存在同名文件且同行不同內容的情況下),如果出現則需要解決。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章