git use (2)--Build a remote repository on GitHub

Source: Internet
Author: User
Tags tagname

Using GitHub as a remote repository
GitHub website: https://github.com/

    • 1. Create SSH key

If you do not have a. SSH directory, or the. SSH directory does not have Id_rsa and id_rsa.pub these two files:

Ssh-keygen " [email protected] "

Copy the id_rsa.pub to SSH key. Create a new key.

    • 2. Add a remote Library

Log on to GitHub and then, in the upper right corner, find the "Create a new Repo" button to create a new warehouse.

    • 3. Local upload (first set up is a hint on github)
git remote add origin [email protected]:p ath/repo--u Origin master #第一次推送master分支的所有内容; Git push origin maste R #推送最新修改;

    • 4. Copying from a remote library
git clone [email protected]:[github username]//code warehouse name].git

You can use the SSH protocol for replication, or you can use the HTTPS protocol for replication.

git clone https://github.com/[user name]/testgit.git

    • 5. Create a new branch
Git checkout-b a #创建一个新的分支 A,-B means to create and switch to the equivalent of the following two instructions: Git branch agit checkout a    git branch #查看当前分支情况,* indicates the current Support *<name> #将 <name>-D <name> #删除分支

6. Marking tags

ID"blablabla ... "  <tagname>---D <tagname> #删除一个本地标签git push origin:refs/tags/< Tagname> #删除一个远程标签

7. Using GitHub
On GitHub, you can fork the open source Warehouse;
Own the fork after the warehouse read and write permission;
You can push pull request to the official repository to contribute code.

git use (2)--Build a remote repository on 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.