GitHub Quick Start manual

Source: Internet
Author: User
Tags version control system

Recently I tried GitHub. The idea of open source also makes people feel that sharing some experiences is a very good thing. The attachment is a DOC file. Check the file if necessary. Hope to help you.

GitHub Internet-based version control Quick Start manual

If you have any questions, please correct them.

Reprinted please indicate the source!

GitHub wiki: http://en.wikipedia.org/wiki/GitHub

GitHub Official Website: https://github.com/

 

If you are still using CVS, SVN, or other balabala version control tools, you will be out. If you do not know GitHub yet, now you have a chance.

In 2005, Linus Torvalds (father of Linux) developed a git version control system to solve problems encountered in processing Linux Kernel patches. A few years later, GitHub, based on git, came into being with a beautiful Web user interface, which enables branch operations and patching for projects on this platform, and code submission. It adopts a standardized Wiki and issue tracking system, which means that all projects are built in the same way. Once you learn how to submit code to a project on GitHub, you know how to submit code to all other projects.

In fact, the most important thing is that you know or can use it. At the same time, you can increase the highlights of your discussion with customers. Next, we will briefly introduce and use GitHub to implement basic version control. Of course, you can also directly read more detailed official documents. If you are willing to learn from some of the content in this document, you will also reserve your rights.

Advantages:

1. Convenient merging and derivation mechanisms. You can dispatch and merge data on any version.

2. The social version library is a private, invisible public view library.

3. Internet-based storage and distribution, which is equivalent to a distributed version library on the Internet.

 

Prerequisites:

To facilitate subsequent operations, you can register an account at github.com for free.

1. installation and configuration

(1) For download and installation, refer to http://help.github.com/win-set-up-git/. the following uses Windows as an example.

After the installation is complete, start GitHub in Windows. The following page is displayed,

Now you have completed a big step. Let's continue.

 

(2) generate an SSH key

In the bash interface, enter:


Of course, you can replace the yellow part with your email address and corresponding directory. When prompted, enter the public key and password you want to connect to the version library using SSH.

After the public key is generated, a similar interface is displayed. And generate. the id_rsa.pub file in the SSH file will be what we need next (provided that you must set the hidden file to be visible in Windows ).

 

(3) bind your SSH key to your GitHub account

In the upper-right corner of the dashboard homepage, choose 1.

Click "sshpublic keys" on the left side of the accountsetting interface, and then "add another public key". After the above SSH key is created. copy the content of the id_rsa.pub file in the SSH directory and copy it to the following box (title is not required

Click Add key and OK to complete this step.

 

(4) test

Enter the following in the bash interface of GitHub:

Enter "yes" in the following interface

Under normal circumstances, the following interface appears, and the installation is basically complete.

 

(5) configure the user name and email information

You can change the yellow part to your personal name and email.

 

(6) Configure GitHub token

In the upper-right corner of the dashboard homepage, click account settings to copy your information token in the figure.

 

You can press Ctrl + insert on the bash interface of GitHub to paste the content in the clipboard.

Finally, if you run the preceding command in bash, the configuration can be completed.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Ii. Create a version Library

(1) On the dashboard homepage, click "new repository" in the lower right corner"

(2) Fill in the project information and click "create reporsitory ",

 

(3) In this step, we will submit a file to the version library, and the code can be submitted in the same way.

GitHub Bash is actually a bit like Linux Bash. You can open VI or execute Linux commands. Of course not all commands are available, at least common commands are available.

The commands we want to execute in sequence include:

Create directories, enter directories, initialize git, and create files (upload files to the version Library)

(4) connect your local GitHub repository to your GitHub account (of course, you must enter the corresponding. in the file directory of git, or you will be prompted that you cannot find it. git file .. Git files exist in the directory initialized after you execute git init)

File submission

Those who have used SVN may think about the starting point.

You will see a page similar to the following,

Now, you have learned how to submit files.

· Connect to the remote version Library:

Next time you use Bash, enter

$ Ssh-V [email protected] can connect to the remote version library.

 

· Submit an existing file:

If you submit an existing file, you can directly use

$ Git commitfilename-m'message' the yellow part can be filled in according to the actual situation. This submission submits the file to the local storage version library. To submit to a remote account, run the following command:

$ Git push origin master now, the file has been synchronized with the version library of the GitHub account.

 

· Local and server version synchronization (refer to the Command in ):

This synchronization function is not very good. If you use sshfq on Linux, the effect may be better.

Iii. New versions

You can choose to copy a copy from the version library to your local database, which is equivalent to a copy of checkout, such as in SVN:

$ Git clone [email protected]: username/Spoon-Knife.git

For example, the yellow part can be replaced with your information.

Then configure remote properties,

Here are several concepts. The clone version has a default remote name "origin ". This origin is different from the main version of the version library of your GitHub account. If you need to track the main version, you can use another remote name "upstream ".

 

More functions:

1. You can also update or merge the files in the main version to your branch version Library (for operations on your branch version)

2. You can also initiate a merge request to the main version, waiting for the relevant personnel to add your code to the main version.

3. Delete the branch version, remove the master version, and so on.

 

There are also social functions waiting for you to explore. For example, you can view the projects under development by the people you are interested in. You can join a project under development by others and create a branch. Then write the code and then submit the code. If you are considering which version control tool to use, GitHub is strongly recommended here.

GitHub Quick Start manual

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.