解决failed to push some refs to 'x',Updates were rejected because the tip of your current branch 问题

向github库里push代码报错:

error

错误提示为:未能将一些参考资料推入库中,更新被拒绝,因为当前分支的提示在后面!

这是由于github的版本库没有pull到本地,这样就产生了远程repository和本地的repository的版本冲突。

解决方法有:

1.创建新的分支:

$ git branch 名称

然后push到远程

$ git push -u origin 名称

2.强制push到远程

$ git push -u origin master -f

3.先从远程pull一下,然后在重新push

$ git pull origin master
$ git push -u origin master

你可能感兴趣的:(解决failed to push some refs to 'x',Updates were rejected because the tip of your current branch 问题)