Submit a local project to Github/gitlab [change]

Source: Internet
Author: User
Tags commit

The article is from copy. But it didn't work out. After the 5th step, I add the content. It's my pleasure to help you.
Preparatory work:

Create a new project in Github/gitlab audit

1. Initialize the local repository in the local directory zhunions directory

Git init

2. Create a. Gitignore readme.md file

3. Local Submissions

git Add. 
Git commit-m "First commit"

4. Add a remote association

Git remote add Origin git@172.16.10.9:namespace/zhunions.git

5. The local branch is associated with the remote branch and pushed to the remote repository

git push--set-upstream Origin Master

The 5 steps above can be used to correlate local warehouses and branches with remote warehouses and branches.

If a git pull appears

Fatal:refusing to merge unrelated histories

Perform

Git pull Origin branchname--allow-unrelated-histories

Branchname Change to Master
The local master and the remote master have already established a connection.
Next switch to Dev

$ git branch-a
  * Master
  remotes/origin/dev
  Remotes/origin/master

Not to be continued

After performing all operations, the following results are available:

A. Generating a local branch master

B. Remote warehouse associated with a local warehouse origin

C. Remote Branch master associated with a local branch

D. The local code is all submitted to the remote repository and others can share the

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.