git push origin master 報錯

git push origin master 報錯,報錯信息如下:

To gitee.com:xxx/xxx.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to '[email protected]:xxx/xxx.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.

根據錯誤提示,首先應該git pull 一下或 可解決此問題,於是:
git pull origin master

然而又報錯:

fatal: refusing to merge unrelated histories

遂百度,覓得一解決方法:git fatal: refusing to merge unrelated histories
–>
“pull時添加 –allow-unrelated-histories”

即刻執行之:
git pull origin master --allow-unrelated-histories
git pull錯誤完美解決!

接着執行:
git push origin master
成功執行,錯誤解決!

感悟:

初出茅廬,知之尚淺,仍需努力、努力、再努力。

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