VS2019提交代码至github出错rejected Updates were rejected ...
程序员文章站
2022-04-17 18:44:51
...
原文首发于:https://hjxlog.com/posts/20200321a1.html
在使用VS2019的git插件进行代码版本管理时,推送代码至github出错,出错信息如下:
Pushing to https://github.com/huangjianxian/DataStructure.git
To https://github.com/huangjianxian/DataStructure.git
Error: failed to push some refs to 'https://github.com/huangjianxian/DataStructure.git'
Error: 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.
发布到远程存储库时遇到错误: rejected 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 before pushing again.
未能推送到远程存储库。请参见输出窗口了解更多详细信息。
看错误提示,这是因为git仓库在其他地方被修改了,所以你要先本地将最新代码pull拉取下来,然后再和你原有的代码进行合并提交。
后来想了想,是因为我在GitHub网页上改了一下仓库的readme,所以才会报这个错。没怎么学习过git,有时间一定要学习一下…