您现在的位置是:首页 > 其他

李清波 2017-03-27 其他 1792 复制当前网址

error: failed to push some refs to


不知道做了什么非人的改动,今天push Github的时候,出现了一句错误提示:

error: failed to push some refs to 'https://github.com/......'hint: Updates were rejected because the tip of your current branch is behindhint: its remote counterpart. Integrate the remote changes (e.g.hint: 'git pull ...') before pushing again.



想到也没做什么,就直接强制push了。

$ git push -u origin master -f


其实就上面这一句就能解决了,不过合作项目的时候,还是建议不要用这种方法的好。 

顺便搜索了下别的解决方案:

1. push前先将远程repository修改pull下来

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

2. 若不想merge远程和本地修改,可以先创建新的分支:

$ git branch [name]
$ git push -u origin [name]


文章来源:http://liqingbo.com/blog-1328.html

评论