Stay hungry,Stay foolish!

0%

VS2019提交代码至github出错rejected Updates were rejected ...

在使用VS2019的git插件进行代码版本管理时,推送代码至github出错,出错信息如下:

1
Pushing to https://github.com/huangjianxian/DataStructure.git
2
To https://github.com/huangjianxian/DataStructure.git
3
Error: failed to push some refs to 'https://github.com/huangjianxian/DataStructure.git'
4
Error: hint: Updates were rejected because the remote contains work that you do
5
hint: not have locally. This is usually caused by another repository pushing
6
hint: to the same ref. You may want to first integrate the remote changes
7
hint: (e.g., 'git pull ...') before pushing again.
8
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
9
发布到远程存储库时遇到错误: 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.
10
未能推送到远程存储库。请参见输出窗口了解更多详细信息。

看错误提示,这是因为git仓库在其他地方被修改了,所以你要先本地将最新代码pull拉取下来,然后再和你原有的代码进行合并提交。

微信图片_202003210945552020-3-21-9-58-39

后来想了想,是因为我在GitHub网页上改了一下仓库的readme,所以才会报这个错。没怎么学习过git,有时间一定要学习一下…