问题现象:

$ git push origin dev

To http://xxxxxx/Android.git

! [rejected]        dev -> dev (fetch first)

error: failed to push some refs to 'http://xxxxxx/Android.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 push报错:Updates were rejected because the remote contains work that you do not have locally_android

问题原因:

其他地方向同一远端库推送了代码,导致本地不是最新的。

解决方案:

先从远端pull一下,执行:git pull

关于我

厦门大学计算机专业 | 前华为工程师

分享编程技术,没啥深度,但看得懂,适合初学者。

Java | 安卓 | 前端 | 小程序 | 鸿蒙

公众号:花生皮编程

解决git push报错:Updates were rejected because the remote contains work that you do not have locally_android_02