git pull項(xiàng)目時(shí),出現(xiàn)refusing to merge unrelated histories

首先在GitHub上創(chuàng)建了新的repositories,然后AS本地新建了android工程,當(dāng)加入git版本控制后,使用git命令pull拉取GitHub上的項(xiàng)目文件時(shí),出現(xiàn)的了錯(cuò)誤提示:

fatal: refusing to merge unrelated histories


因?yàn)樗麄兪莾蓚€(gè)不同的項(xiàng)目,要把兩個(gè)不同的項(xiàng)目合并,git需要添加一句代碼,最新的版本需要添加--allow-unrelated-histories



假如我們的源是origin,分支是master,那么我們 需要這樣寫(xiě)

git pull origin master --allow-unrelated-histories



然后你可以利用git status查看一下當(dāng)前倉(cāng)庫(kù)的狀態(tài),是不是所有的全部add并且commit,如果全部完成,那么此時(shí)你就可以將本地倉(cāng)庫(kù)中的推送到github中,使用如下的git命令:

git push -u origin master



另:Can't update:no tracked branch

No tracked branch configured for branch master. To make your branch track a remote branch call, for example,

git branch --set-upstream-to origin/master master

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容