本文主要是介绍Git 报错:Updates were rejected because the remote contains work that you do not have locally.,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
报错:
Updates were rejected because the remote contains work that you do not have locally. This is usually caused by another repository pushing to the same ref. You may want to first integrate the remote changes (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
意思:
由于远程包含本地没有的工作,更新被拒绝。这通常是由另一个存储库推送到同一个ref引起的。您可能希望在再次推之前首先集成远程更改(例如,“git pull…”)。
提示:有关详细信息,请参阅“git push--help”中的“关于快进的说明”
原因:其他地方向同一远端库推送了代码,导致本地不是最新的
解决1:先从远端 pull 一下,执行:git pull
解决2:直接通过 VSCode 执行操作,VSCode 会先从远端拉下来再提交上去
这篇关于Git 报错:Updates were rejected because the remote contains work that you do not have locally.的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!