Git: failed to push some refs although I have done git pull

前端 未结 7 1463
清酒与你
清酒与你 2021-02-07 01:19

I started to get \'failed to push some refs\' error when I changed some files and tried to do push. Most instructions tell to do git pull first. I have done it and git says ever

7条回答
  •  梦如初夏
    2021-02-07 02:02

    The error is that somebody else has pushed in the master branch and you would overwrite their change if git allowed you to push (this is what non-fast forward error means). So you need to merge your local master branch with the remote master branch.

    This can happen if you did the git pull while the local branch was not the master branch. If you only want to push the branch you are working on and not the master branch, you need to tell it to git using the complete form of git-push:

    $ git push remote local-branch:remote-branch
    

提交回复
热议问题