git Beginner Tutorial

Source: Internet
Author: User
Tags git client

-----------Novice To do the tutorial, the effect is not good everyone understanding

Learning git today has been quite a long time. Well, let's just record how it is, personal experience is for reference only.

Steps:

1. Software download

2. Software Installation

3. Software Registration

4. Create a remote repository

5. Create a local warehouse

6. Generate SSH Keys

7. Download the remote library project to the local library

8. Upload the local library project to the remote library

Software download

I'm here to choose git for window, Msysgit is http://msysgit.github.com/

Software Installation

Download to the software, the general default installation in the system disk C:\Program files, for the novice basically do not have to change anything, directly next to the line,

Complete the installation of the GIT client, there will be two options, a real command-line operation of the window, the other is to facilitate the window user's graphical interface window. The general choice is to write the command.

Software Registration

Open Gitbash, directly displayed is the black and black interface, only a few lines of command and letters

The first thing we need to do is register our username and email address to verify your personal information.

Create a remote Warehouse

Then, in general, create a local repository, but as I understand it, you should first register an account with a remote repository .

Of course, we have more choices, I registered an account in https://github.com/, follow the process to go on the line.

On the site https://guides.github.com/activities/hello-world/carefully read the creation of a simple remote repository.

Create a HelloWorld code base on your account, check the README option

Then there will be a simple project library.

Create a local warehouse

Then we're going to create a local repository on the hard drive.

We created a new folder on a sub-disk, and I named code

No, it's okay. Go to the Command line window

Now the window is in this directory, we go to the directory of the Code folder

Then use the command in the current directory

A. Git hidden file will appear in the folder. It will mark this folder as the local repository

Establish SSH key

We created the local repository and the remote repository, respectively, on the computer itself and on the far end server, and we needed to establish a connection between the two to allow the download file to be uploaded directly between the two.

GitHub is based on the SSH protocol, so we can map these two warehouses directly via SSH.

To generate an SSH key procedure:

Exit the Warehouse Directory

1. See if you already have an SSH key:

If there is no key then there will be no such folder, there is a backup to delete

2. generate the key:

Press 3 to enter, the password is empty.

Your identification has been saved In/home/tekkub/.ssh/id_rsa.

Your public key has been saved in/home/tekkub/.ssh/id_rsa.pub.

The key fingerprint is:

..................

Finally, two files were obtained: Id_rsa and Id_rsa.pub

Where Id_rsa holds the private key, Id_rsa.pub stores the public key

3. add SSH key on GitHub, add the public key of "Id_rsa.pub" , find the public key file in the relevant directory, open the copy and paste it to GitHub with Notepad.

4. test:ssh [email protected]

The authenticity of host ' github.com (107.54.217.219) ' can ' t be established.
RSA key fingerprint is16:27:ab:a5:58:28:2d:49:63:1b:56:4d:eb:df:a6:48.
Is you sure want to continue connecting (yes/no)? Yes
Warning:permanently added ' github.com,107.54.217.219′ (RSA) to the list Ofknown hosts.
Error:hi tekkub! You ' ve successfully authenticated, but GitHub does notprovide shell access
Connection to github.com closed.

So two warehouses have a lock on each other to open the door, a road. This road is an [email protected]: Guyongdai/helloworld.git

So write commands in the local repository directory to add remote repositories

$ git Remote add origin [email protected]: Guyongdai/helloworld.git

Remember to replace the above Guyongdai with your own GitHub account name

It is also important to note that the name of the library in the Helloworld.git to write the right, or not on. If you're building HelloWorld1 on a remote repository, write Helloworld1.git.

To download the project for the Remote library:

We clone a project from our remote repository to the local repository.

Use the note command-line directory to be the local repository directory

This way, the repository for remote repositories is downloaded locally.

Then you how to program how to program, is the development tool to save directory settings in this folder on the line, and later this project programming code saved in the HelloWorld folder.

Uploading a local project to a remote repository

After the folder contents have been changed, upload to the remote repository as follows:

1. Make sure your current directory is within the HelloWorld folder or within the Code folder

2. Save the files in the folder and any changes to the local repository

3. Submit a change statement or comment

4. Upload Cloud Remote Repository

Well, Git is just the beginning of this, more and more detailed to be continued ...

git Beginner Tutorial

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.