Git常見(jiàn)錯(cuò)誤

xcrun: error: invalid active developer path

使用終端克隆github的代碼到本地時(shí)報(bào)錯(cuò)

報(bào)錯(cuò)信息

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

解決辦法
sudo xcode-select --reset

fatal: refusing to merge unrelated histories

推到倉(cāng)庫(kù)時(shí)報(bào)錯(cuò),字面意思是拒絕合并不相關(guān)的歷史

報(bào)錯(cuò)信息

fatal: refusing to merge unrelated histories

解決辦法

原因是兩個(gè)分支是兩個(gè)不同的版本,具有不同的提交歷史,可以添加參數(shù)--allow-unrelated-histories(git 2.9.2,允許合并兩個(gè)記錄的倉(cāng)庫(kù))解決

官方解釋.png

// 拉取遠(yuǎn)程倉(cāng)庫(kù)的文件到本地(允許獨(dú)立記錄)
git pull origin master --allow-unrelated-histories

// 以下兩者任選其一

//// 建立本地分支與上游的關(guān)系
// git push --set-upstream origin master

// 推送本地倉(cāng)庫(kù)的提交到遠(yuǎn)程倉(cāng)庫(kù)
// git push <遠(yuǎn)程主機(jī)名> <本地分支名>:<遠(yuǎn)程分支名>
git push 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)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

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

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