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.

错误原因:在github上修改了文件,没有更新到本地就上传
解决方法:本地和远程的文件应该合并后才能上传本地的新文件
具体方法:

1、先pull拉下来,会自动合并的(不用担心)

git pull origin master

2、再上传

git push -u origin dev-trunk
也可以通过TortoiseGit拉取、提交

posted @ 2022-09-16 16:02  一刹流云散  阅读(1077)  评论(0编辑  收藏  举报