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

问题现象:

| $ 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.

|

image.png

问题原因:

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

解决方案:

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

你可能感兴趣的:(解决git push报错:Updates were rejected because the remote contains work that you do not have locally)