Why I cannot push my code to github?

后端 未结 2 670
忘了有多久
忘了有多久 2021-01-15 18:37
$git push origin master
To git@github.com:dimitar9/first_app.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to \'git         


        
相关标签:
2条回答
  • 2021-01-15 19:11

    You need to do a git pull first.

    Update with explanation: Because you don't have the latest code, git forces you to do the merge on your side before pushing changes. This is to help prevent losing changes other people have made.

    If you have any conflicts, you should review them to decide whether the local or remote code is what you want to commit.

    0 讨论(0)
  • 2021-01-15 19:34

    This means that there are some changes on GitHub which have not been merged into your current branch. To resolve this, do what the error message is telling you to: git pull, resolve any conflicts, then try pushing again.

    0 讨论(0)
提交回复
热议问题