学无先后,达者为师

网站首页 编程语言 正文

解决git 错误error: failed to push some refs to......

作者:generallizhong 更新时间: 2022-04-11 编程语言

错误信息:

error: failed to push some refs to 'git@github.com:....." Updates were rejected because the remote contains work that you do not have locally.

This is usually caused by another repository pushing to

原因分析:

1、在使用git 对源代码进行push到gitHub时可能会出现的此错误

2、出现错误的主要原因是github中的README.md文件不在本地代码目录中

解决办法:

办法1:先拉下来,会自动合并的(不用操心)

命令:git pull origin master

办法2:可以通过如下命令进行代码合并

命令:git pull --rebase origin master   (我的成功解决是方法2)

最后:再执行语句 git push 即可完成代码上传到github

命令:git push -u origin master

原文链接:https://blog.csdn.net/generallizhong/article/details/96115192

栏目分类
最近更新