$ 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
Similar Posts:
- [Solved] gitee Push Error: error: failed to push some refs to
- How to Solve error: failed to push some refs to ‘xxxx’
- [Solved] 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
- Git Push Error: rejected error: failed to push some refs to… [How to Solve]
- error: failed to push some refs to ‘https://gitee.com/XXXX/ui-demo.git’