How to resolve failed to push some refs to git__git

Source: Internet
Author: User
Error

$ Git push-u Origin Master

To Git@github.com:yangchao0718/cocos2d.git

! [Rejected] Master-> Master (Non-fast-forward)

Error:failed to push some refs to ' git@github.com: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.

Hint:see the ' about Fast-forwards ' in ' git push–help ' for details. problem

How to resolve failed to push some refs to git
Tools/raw Materials
Git
Method/Step 1

At this point many people will try the following command to upload the current branch code to the Master branch.
$ Git push-u Origin Master
But still failed to solve the problem 2

The main reason for the error is that the readme.md file in GitHub is not in the local code directory
You can merge code with the following command "NOTE: Pull=fetch+merge]
Git pull–rebase Origin Master
After executing the above code, you can see that there are more readme.md files in the local code base 3

Now execute the statement GIT push-u Origin master to complete the code upload GitHub

Reference:
Baidu Encyclopedia

CSDN code to create a project

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.