Git錯(cuò)誤提示小筆記

日期:2017-05-04
起因:想要push一個(gè)本地庫(寫好的)到遠(yuǎn)程庫(新建的)中,報(bào)了三次錯(cuò)誤,一一記錄下來。

錯(cuò)誤一,遠(yuǎn)程庫和本地庫不匹配,遠(yuǎn)程倉庫比本地庫更新,讓我們先git pull一下。

wangweilongdeMac-mini:UUID+Keychain wangweilong$ git push -u origin master
To github.com:Jason-IUVO/UUID-KeyChain.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'git@github.com:Jason-IUVO/UUID-KeyChain.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

錯(cuò)誤二,沒有指定分支去pull,解決方法已經(jīng)提示我們了:git pull <remote> <branch>

wangweilongdeMac-mini:UUID+Keychain wangweilong$ git pull
warning: no common commits
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 5 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (5/5), done.
From github.com:Jason-IUVO/UUID-KeyChain
 * [new branch]      master     -> origin/master
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=origin/<branch> master


錯(cuò)誤三,拒絕合并非相關(guān)聯(lián)的歷史,解決方案:git pull origin master --allow-unrelated-histories

wangweilongdeMac-mini:UUID+Keychain wangweilong$ git pull origin master
Warning: Permanently added the RSA host key for IP address '192.30.255.112' to the list of known hosts.
From github.com:Jason-IUVO/UUID-KeyChain
 * branch            master     -> FETCH_HEAD
fatal: refusing to merge unrelated histories

to be continued...

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

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

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