Submit a local Java project to GitHub

Source: Internet
Author: User

1. After we have created a new Java project, we need to submit it to GitHub for version control

2. If the warehouse in GitHub is not empty at this time, we will report the following error when we use GIT push submission locally.

! [Rejected] master, master (Non-fast-forward)

Cause: A file that does not exist in the local project already exists in the GitHub repository, and a flush map has occurred

Workaround: First pull down all the files in the GitHub repository, as this is the 2 unrelated repositories, the direct git pull will error:

Fatal:refusing to merge unrelated histories

Workaround: Add--allow-unrelated-histories after the pull instruction, which is the final command: Git pull--allow-unrelated-histories

After 3.pull, the push can be used again to successfully commit to the remote repository

Submit a local Java project to GitHub

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.