GitHub entry to upload local project online resource integration __github

Source: Internet
Author: User
Tags svn git client using git version control system

"On the basis of the original article, modified the description of the lack of detail, the content of the expansion of the integration of some information on the Internet."

"Content mainly from HTTP://WWW.CNBLOGS.COM/SPECTER45/P/GITHUB.HTML#GITANDSVN"

GitHub is a code-hosted implementation based on Git. Git is the best version control system at the moment, very popular and better than SVN.

GitHub can be used for free and fast and stable. Even a paid account, no more than 10 U.S. knives per month is very cheap.

With GitHub, you can archive projects, share conversations with others, and let other developers help you with the project. The advantage is that he supports multiple people to accomplish a project, so you can talk and talk on the same page.

Create your own project and back up, the code does not need to be saved locally or on the server, GitHub is very ideal.

There are many benefits to learning git. He is treated as a pre maintenance process, you can recover from your own needs, submit problems, or you need to recover any form of code, you can avoid a lot of trouble. One of the best features of git is the ability to track bugs, which makes using GitHub easier. Bugs can be made public and you can submit errors through GitHub comments.

On the GitHub page, you can start directly without having to set up a host or DNS.

For me, I can edit the same set of code in the company and home, using a U disk or a network disk is very troublesome to say

Theory says too much is easy to forget, to practice it.

Outline: First, create GitHub repository (warehouse) Two, install Git client three, for GitHub account set SSH key four, upload local project to GitHub

First, create GitHub repository (warehouse)

1-1 Login GitHub

GitHub's official web site: https://github.com, if there is no account, hurriedly register a.

Click Sign in to enter login interface, enter account number and password login github.

1-2 Create repository (warehouse)

Why call Repository (warehouse). I also wondered at first that the code base was not simpler and clearer. But carefully pondering, warehouses are generally put grain, it is the code as a full belly, love, and instantly feel that this cold cold code full of chakra.

Pull away, see how to create a warehouse, login can see the Repository tab

If not in this page also does not matter, click on the upper right side of the head of the small triangle, after the expansion can be seen your profile, click to enter can also see repository

Switch to the Repository tab and you can see the new button that is very eye-catching. Don't hesitate, click on it and start creating your own granary.

The following is the creation of warehouse information, only the name is required, and now I have created a warehouse called: Beautifulday

After the success of the creation, you can see your own warehouse address, so that my remote free warehouse was created. It also introduces the common instructions for the GitHub warehouse.   This directive requires a GIT client to be installed locally. Git init//Turn this directory into git can manage the warehouse git add readme.md//Files added to the warehouse git Add. Not only can with a single file, but also with the wildcard, can be with the directory. At one point, all of the files that are not tracked in the current directory are added to git commit-m "a"///Submit files to the warehouse Git add Origin git@github.com:wangjiax9/pract Ice.git//Associated remote warehouse Git push-u Origin master//push all contents of local library to remote library

Second, install git client

Git is currently the world's most advanced distributed version control system, git and svn five basic differences. It has the following characteristics:

Distributed: Git version control system is a distributed system, which is used to save the history state of Engineering Source code command line tools;

Save point: Git save point can track files in the source code, and can get the whole project amount at a certain point in time; You can merge the source code that is submitted by many people at the save point, or you can retreat to a savepoint.

git offline operability: git can be offline for code submission, so it's called full distributed processing, and all of Git's operations do not need to be done online; This means that git is much faster than SVN and so on, because tools such as SVN need to be online to operate, and if the network environment is bad, submitting code can become very slow;

Git is based on snapshots: The old version control tool such as SVN is to save the submission point as a patch file, and Git commits to point the submission to the project snapshot at the time of submission, and the submission contains some metadata (author, date, GPG, etc.);

The branching and merging of git: The branching model is the most notable feature of Git, because it changes the developer's development model, and SVN and other version control tools place each branch in a different directory, and git can switch between different branches in the same directory;

Branching immediacy: Creating and switching branches is almost simultaneous, users can upload part of the branch, another part of the branch can be hidden in the local, do not have all the branches uploaded to the GitHub;

Branching flexibility: Users can create merge deletion branches at any time, many people implement different functions, can create multiple branches for development, and then branch merge, which makes development fast, simple and secure.

2-1 Download git client

Official Download Address: http://git-scm.com/download/According to your own system download the corresponding version, did not expect it to know that I am a Windows ^_^

2-2 Installing the Client

After the download, we start to install it, welcome to the interface, next.

Choose the installation path, do not choose the path with Chinese, sometimes will cause unnecessary misunderstanding.

Select the installation component and press the default to do so.
1) Icon Component (addition icons): Choose whether to create a Quick Launch bar icon or whether to create a desktop shortcut;
2 Desktop Browsing (Windows Explorer integration): Browse the source method, separate context browsing only using bash or just git GUI tools; The advanced context browsing method uses Git-cheetah plugin plug-ins;
3) associated configuration file (associate. git*): Whether the git configuration file is associated, which mainly displays the style of the text editor;
4 The associated shell script file (associate. Sh): Whether to associate the script file executed by the bash command line;
5 Use TrueType Encoding: Whether Truthtype encoding is used on the command line, which is a common code developed by Microsoft and Apple;

Set the directory name of the shortcut in the Start menu, the default is good, next step

Setting environment variables: Choose which command-line tools to use, and in general we use GIT bash by default, the default choice;
1 git: Using Git's own git bash command line tool;
2 system with CMD: the use of Windows system command line tools;
3 Both have: The above two are configured at the same time, but note that this will be Windows Find.exe and Sort.exe tool coverage, if not understand these as far as possible not to choose;

Select the line-wrapping format, which is still the default.
1 Check out the Windows format conversion to UNIX format: The Windows format of the newline into Unix-style line in the submission;
2 Check out the original format into the UNIX format: No matter what format, all converted to UNIX-style line in the submission;
3 No format conversion: No conversion, check out what, on the submission of what;

Choose Terminal Emulator, still the default is good

1 The use of Mintty, is in windows open a simple Simulation Linux command Environment window git Bash

2 command-line programs for Windows-using systems cmd.exe

In this step, the newer version will have one more option, below is the comparison

A, enable file system caching allows the caching of files. That is, when the file is submitted, you can first put the file into the buffer, and then unified submission.

B, enable git credentialmanager allows git license management (detects and downloads. NETFramework v4.5)

In the installation ...

Git finally installed successfully.

2-3 Bound Users

Open Git-bash.exe, in Desktop shortcuts/Start menu/installation directory

Because Git is a distributed version control system, you need to fill in the username and mailbox as an identity, user and mailbox for your GitHub registered account and mailbox

PS:git config–global parameter, with this parameter, means that all git warehouses on this machine will use this configuration, but you can also specify different user names and mailboxes for a warehouse.

third, set SSH key for GitHub account

It is well known that SSH key is a cryptographic transmission.

There are many algorithms for encrypting the transmission, and one of the core questions that Git uses Rsa,rsa to solve is how to use a pair of specific numbers so that one number can be used for encryption, and another number can be used to decrypt it. These two numbers are the public key that you encounter when you use Git and GitHub, which is also the private key.

Where the public key is the number that is used to encrypt, which is why you have to upload it to GitHub after the local public key is generated. Sent back from the GitHub, with the public key encrypted data, you can use the local private key to restore.

If your key is lost, whether it's a public key or a private key, you can't use the missing one, the solution is simple, regenerate again, and then set it again in the github.com.

3-1 Generate SSH Key

First check that the key CD ~/.ssh,ls has been generated if there are 3 files, the key has been generated and id_rsa.pub is the public key

You can also open My Computer C:\Users\specter\.ssh to find

If there is no build, then the $ ssh-keygen-t rsa-c "6215048wjl@163.com" is generated.

1) is the path to confirm, directly press ENTER to save the default path can be

2 Direct return, here we do not use the password to log in, with the password too troublesome;

3) Direct Enter

After the success of the build, go to the corresponding directory C:\Users\specter\.ssh (specter for computer user name, each person is different) with Notepad open id_rsa.pub, get SSH key public key

3-2 Configure SSH key for GitHub account

Switch to GitHub, expand the personal avatar of the small triangle, click the settings

Then open the SSH keys menu, click Add SSH key New key, fill in the title, with the warehouse to keep in line, good distinction.

Then paste the Id_rsa.pub file key to this, the last add key to generate the key bar.

Thus, the SSH keys configuration for the GitHub account is complete.

four, upload local project to GitHub

4-1 Creating a local project

I created a few empty folders and a file and a project profile, and a lot of the front-end projects are structured like this, and I follow the trend.

4-2 Build Local Warehouse

Let's review the instructions for creating a new warehouse: Git init//Turn this directory into git can manage the warehouse git add readme.md//Files added to the warehouse git Add. Not only can with a single file, but also with the wildcard, can be with the directory. At one point, all of the files that are not tracked in the current directory are added to git commit-m "a"///Submit files to the warehouse Git add Origin git@github.com:wangjiax9/pract Ice.git//Associated remote warehouse Git push-u Origin master//push all contents of local library to remote library

First, go to the Beautifulday project directory, remember to create the warehouse after the success of the page, the instructions are there.

And then execute the instructions: Git init

After the initialization is successful you will find a hidden folder in the project. Git

This directory is used by Git to track the management version of the library, no matter do not manually modify the files in this directory, or to change the chaos, the Git warehouse to destroy.

Next, add all the files to the warehouse

Execute instruction: git Add.

Then, the file is submitted to the warehouse, and the double quotation marks are submitted in the comment.

Execute instruction: git commit-m "Submit file"

So the local warehouse is well established.

4-3 Association GitHub Warehouse

Copy warehouse address to GitHub Beautifulday Warehouse

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.