$ git push -u origin master
To [email protected]:yangchao0718/cocos2d.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to ‘[email protected]:yangchao0718/cocos2d.git
hint: Updates were rejected because the tip of your current branch is behin
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: ‘git pull …’) before pushing again.
The main reason for the error is that the README.md file in github is not in the local code directory
You can merge the code with the following command [Note: pull=fetch+merge]
git pull –rebase origin master
After executing the above code, you can see that the README.md file is added to the local code base
At this point, you can upload the code to github by executing git push -u origin master
- How to Solve error: failed to push some refs to ‘xxxx’
- Git Push hint: Updates were rejected because the remote contains work that you do hint: not have …
- [Solved] Updates were rejected because the tip of your current branch is behind
- [Solved] Git pull fatal: refusing to merge unrelated histories
- error: failed to push some refs to ‘https://gitee.com/XXXX/ui-demo.git’
- Git | fatal: refusing to merge unrelated histories [How to Solve]
- Git Pull Error: Please specify which branch you want to merge with.
- Git pull does not specify an error message for the branch