How to troubleshoot failed to push some refs to git

Source: Internet
Author: User
Tags using git

[Email protected]/k/cocos2d/YC (Master) $ git push-u Origin masterto [email protected]:yangchao0718/Cocos2d.git! [Rejected] master, master (non-fast-forward) error:failed to push some refs to'[Email Protected]:yangchao0718/cocos2d.gitHint:updates were rejected because the tip of your current branch is behinhint:its remote counterpart. Integrate the remote changes (e.g.hint:'git pull ...') before pushing Again.hint:See the'Note about Fast-forwards' inch 'git push--help'  forDetails.

1. You may get an error when you push the source code to GitHub using Git, with the following information

2.

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 it still didn't work out.

3. The main reason for the error is that the readme.md file in GitHub is not in the local code directory

4. You can use the following command to merge code "NOTE: Pull=fetch+merge]

Git pull--rebase Origin master

5. After executing the above code, you can see that there are many readme.md files in the local code base

6. Execute the statement now GIT push-u Origin master to complete the code upload to GitHub

How to troubleshoot failed to push some refs to git

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.