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

错误信息:

error: failed to push some refs to '[email protected]:....." 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

你可能感兴趣的:(Android)