A little summary of Git and GitHub (iii)

Source: Internet
Author: User

Finally came to the remote management of this piece, the show is just beginning ah ~ Here we can easily understand the remote as GitHub.

7. Associated remote Warehouses

First of all, you have to register a GitHub account, and then create a new repository so that I don't have to say much. The following questions revolve around how to connect the local repository to the newly created warehouse on GitHub for easy push and pull.

Next, you want to see a link: https://help.github.com/articles/generating-ssh-keys/The title is easy to understand, right? Just do it.

The next step is the key, which connects the local repository to the remote repository:

git remote add [shortname] [url]

ShortName is a remote repository alias, code, not necessarily the name on GitHub, if the name on GitHub is very long, a short shortname can save a lot of things. And the URL is the corresponding remote warehouse address, but the address of the writing is very fastidious, see here:

https://help.github.com/articles/changing-a-remote-s-url/

Anyway, I wrote it so directly:

git remote add record [email protected]:shuai-meng/time_record.git

Then can be various push and pull, here must pay attention to the beginning of the URL: ([email protected]:), a word can not be wrong ...


Once added, you can use Git remote-v to view all remote repositories:

(Currently I only have a remote repository associated with it)


8. Pull or push updates from a remote repository

(1) Push: git push local branch: remote Branch

(2) Fetch: GIT pull remote branch: local branch

This is the two most basic usage, further usage please move to this point: http://blog.csdn.net/u012668018/article/details/24455687

(3) The remote repository has a default branch, but can be modified, only on the page to modify, the method is: Click on the warehouse name, click Settings, then you can see the default branch, choose the one you want.

Write so much for the time being.

A little summary of Git and GitHub (iii)

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.