GitHub Usage Summary

Source: Internet
Author: User

First, GitHub introduction

Git is a distributed version control system that was originally written by Linus Torvalds and used as the management of Linux kernel code. Since its launch, Git has also been a big success in other projects, especially in the Ruby community. GitHub can host a variety of git libraries and provide a web interface. But unlike other services like SourceForge or Google code, GitHub's unique selling point is the simplicity of branching from another project. It is very simple to contribute code to a project on GitHub, by clicking on the "Fork" button on the other person's project and then making the modification on the project that you fork out, and then applying the built-in pull request mechanism to the project owner for a merge of the code.


Second, the use of GitHub simple steps

1.github apply for account and login

2. Create a repository, which is to create a project. The newly created repository will typically include README.MD, LICENSE,. Gitignore these files by default.

3. Install the Git tool on the Linux development machine.

4. Use the Ssh-keygen tool to generate the public and private keys on the development machine. and add the public key to the GitHub account.

Ssh-keygen tool use See "using Ssh-keygen to generate a public key pair under Linux"


Because the development machine and GitHub communication need to be encrypted, the developer's public key is told to GitHub.

5. Execute the git clone https://github.com/***/***.git locally to clone the code in the remote repository locally.

6. Edit the changes and execute git Add. Add the modified file to the staging area

7.git commit-m "* * *" commits the modifications to the local repository.

8.git push xxxx yyyy pushes the local repository to the remote repository. Note XXXX is an alias set for a remote repository with git remote add, and YYYY is the name of a branch of the remote repository.


Iii. Some of the concepts on GitHub

(1) Pull request

There is a warehouse, called Repo A. If you want to contribute to the code, first fork this repo, so in your GitHub account has a repo A2,. Then you work under this repo A2 (develop code, Commit,push, etc.). Then you want the original warehouse repo A to merge your work, you can launch a pull request on GitHub, which means request repo A's owner to merge branches from your A2. If it is approved and formally merged, then you contribute to project A.

(2) Fork

Fork means copying a copy from someone's code base to your own code base, which, unlike normal replication, has all the commit records from the original library, and the code base is completely independent and belongs to you, you can make any changes in your own library Request to submit the merge requests to the original library.

(3) Watch

Watch, which means attention and attention, you'll be notified of a new commit in the code base.

(4) Star

Star, unlike watch, is a collection where you can easily find your star's library, but you won't receive any notifications about that library.

Note:


Iv. participation in open source projects

For example, the highly popular Bootstrap project, which is a very powerful CSS framework, you can access its Project home page https://github.com/twbs/bootstrap, point "Fork" in its own account under the cloning of a bootstrap warehouse , then, clone from your own account:

git clone git@github.com:***/bootstrap.git
Be sure to clone the repository from your account, so you can push the changes. If you clone from Bootstrap's author's warehouse address Git@github.com:twbs/bootstrap.git, because there is no permission, you will not be able to push the modifications. Bootstrap's official warehouse Twbs/bootstrap, the warehouse my/bootstrap you cloned on GitHub, and the warehouse you cloned yourself to your local computer, their relationship is as shown in the following figure:


If you want to fix a bug in bootstrap, or add a new feature, you can start working immediately, and then push to your own warehouse after you're done. If you want Bootstrap's official library to accept your changes, you can launch a pull request on GitHub. Of course, whether the other party accepts your pull request is not necessarily.


V. Introduction of Gitlab

Gitlab is an open source application developed using Ruby on Rails to implement a self-hosted Git project repository that can be accessed through a web interface for public or private projects. It features a similar feature to GitHub, with the ability to browse source code, manage defects, and annotate. You can manage the team's access to the warehouse, which makes it easy to browse through the submitted version and provide a file history library. Team members can communicate using the built-in simple chat program (Wall). It also provides a code snippet collection feature that makes it easy to implement code reuse, so you can find it later when you need it.

Gitlab requires server-side gitolite build (for ease of installation, is now used Gitlab-shell instead of gitolite).


The learning materials are referenced in:

Http://www.worldhello.net/gotgithub/index.html (GitHub Introduction and how to use it in detail)

Http://www.cnblogs.com/jenniferhuang/p/3355248.html

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.