git push origin master 报错

版权声明:本文为博主原创文章,转载请注明出处 https://blog.csdn.net/m0_37750720/article/details/82597504

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
成功执行,错误解决!

感悟:

初出茅庐,知之尚浅,仍需努力、努力、再努力。

猜你喜欢

转载自blog.csdn.net/m0_37750720/article/details/82597504