Solution to non-fast-forward errors in GitHub

Source: Internet
Author: User
Tags how to use git

References

1. http://www.linuxidc.com/Linux/2012-04/58985.htm

2. http://ihower.tw/blog/archives/2620

3. http://hi.baidu.com/lettoo/blog/item/e2e7f30fec72bdf6ab645789.html

Body

You can refer to document 3 to learn how to use git.CodeWhen uploading to git, the following error occurs:

 
Pushing to git@github.com: xwdreamer/firstrepo_xuwei.gitto git@github.com: xwdreamer/firstrepo_xuwei.git! [Rejected] Master-> master (non-fast-forward) error: failed to push some refs to 'git @ github.com: xwdreamer/firstrepo_xuwei.git 'hint: updates were rejected because the tip of your current branch is behindhint: Its remote counterpart. merge the remote changes (e.g. 'git pull ') hint: Before pushing again. hint: see the 'note about fast-forwards 'in 'git push -- help' for details.

I checked some information on the Internet. For details, refer to the content in reference 1. The reason is that the content in git is consistent with the local content. Fetch is required first, then merge is used, and finally push is uploaded. However, this operation is not performed. You can use force push to complete the operation, as shown in the following figure:

SelectForcibly overwrite existing branches (changes may be lost)And then Click Upload. the upload is successful.

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.