GitHub Getting Started Tutorial

From: GitHub novice detailed tutorial

This article is written by myself about GitHub. From the moment I heard this until the setup is successful, there are detailed steps to explain each step, some of which are screenshots or codes from the Internet.

First of all, let me give a brief introduction to GitHub. GitHub has a very powerful function that you can create a library on the server (how to create it will be introduced later). Writing code is a very heavy task, especially When a lot of people complete a large project, it is very complicated. A group of people write a certain project together. The time and progress of completion are different. You write a little and I will write a little, and maybe you even today There was an error in writing, which affected the code I wrote yesterday. Finally, how can I easily summarize everyone's code, and how can I find errors after summarizing everyone's code? A series of problems. So we use the GitHub software. We have a main repository on the GitHub server, where all your code is stored. If you don't pay, everyone can see it. If you don't want others to see your code, you can choose a paid repository. After we create the main warehouse, we can create a branch on the computer, and then you can complete your own code on the computer. After writing, you can directly synchronize the branch on the computer. When you think you can upload your own main warehouse, just You can apply for updates, and when you pass the review, your code will appear in your main repository, so that programmers around the world can view your code. There are now 3 million registered users around the world, and even some fairly well-known open source projects are publishing code there. On GitHub you can see their own code shared by many elites in the computer field. These are the two main advantages of GitHub, for teamwork, and for downloading code from other great people.

 

 

Today, GitHub is: a community of 1.43 million developers. Among them are top hackers like Linux inventor Torvalds and young geeks like Rails founder DHH .

·  The most popular open source hosting service on the planet. At present, 4.31 million git projects have been hosted . Not only are more and more well-known open source projects moving to GitHub, such as Ruby on Rails, jQuery, Ruby, Erlang/OTP; the popular open source libraries in the past three years are often first released on GitHub, such as: BootStrap , Node .js , CoffeScript , etc. Alexa ranks 414th in the world.

 

 

https://github.com/  This isthe official website of GitHub. You can register your own GitHub account on the official website. The website is all in English. For students who are not good at English, it is recommended to use Google Chrome, which can translate web pages. It is very convenient to use in Chinese.

 

After a few simple steps, you will have a GitHub account of your own. After the simple registration is completed, you will need to verify the email address you entered in order to use your GitHub normally.

 After the registration is complete, after completing some simple settings, you need to create a library of your own

 

After logging in to your GitHub account, the small plus sign in the upper right corner of the webpage is the button to create your own library. After translating the webpage into Chinese in the next steps, follow the prompts to create your own library.

 

The first box is to give a name to your library, and the second box is to give a brief introduction to the library

After creating your own library, let your computer clone a library you created, and synchronize the code on your computer to the library you created on GitHub.

  To do this, you need to install a piece of software, Git Bash.

 

Below I will introduce the installation of this software, as well as a simple configuration.

git-scm.com  first enters the GitHub official website and downloads the version suitable for your computer

 

After downloading the installation package, run

 

 

 

The default option can be directly selected during the installation process.


 Most newbies are confused when configuring git bash, and I will have a detailed record of each step of the configuration below . I also got the code from the Internet and from the senior.

 

When I opened the software for the first time, I was confused when I saw this interface, and then I got some ideas after consulting various materials.

 First of all, you need to create an ssh key locally . The purpose of this is that you now need to obtain a key on your computer, which is the same as our usual verification code. After obtaining it, enter it in your GitHub account, and your computer will It is linked to your GitHub account, so that you can easily upload your code at any time through Git bash in the future. The following describes how to enter this key into your GitHub if you get it. 

  

Many people were confused when they opened this GitHub for the first time, thinking what it was. For a novice to see this, there is no idea, no idea.

This column  starts with the name of your computer. In my case, it is Hanani @. The content behind is your computer model. Many times, after some people open the @, it is garbled. Don't care at this time, because some computer models are in Chinese. , there may be a problem in the display, it will not affect your later operation.

  Next, start getting your own key. All functions in git bash are implemented with simple code. Need to enter when getting the key

$ ssh-keygen-t rsa-"[email protected]"

You need to enter this code, and the quotation marks need to be changed to the email account you bound when you registered GitHub. After that, there will be some simple operations for you to confirm, and then you will be prompted for the operation path, password, etc., under normal circumstances, just press Enter and go all the way.

 

If you appear after this interface, it means that your key has been successfully created. Now you need to go to the storage location he just showed to open it and copy the contents.


 

in the .ssh folder

You will see these contents later. Some people will have a pub behind id_rsa. Before watching online tutorials, you need to find a file with pub, because I did not have a .pub file after generating, so I opened id_rsa with trepidation. Later found that the key here can also be used. When opening id_rsa, you need to open it in Notepad.

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDIskXqZF3SSFtACK6zoNGJabikTBC3kig6+4j4dCq1tswhA9YkuJCi0WpRmGYWBQ67dyT2or7RedFZlULLZN3nL6AWlo5V2jRXw4WQxCon2rU1p122wmiTzqYOfsykjwullWV4bYcZU4n77A4/9WwlSqZCpEbcdwV8IMkvwfJUInSWqTvmYMcKTWu8yad5DZ2v7LBWfgsL/Tfx7aEB8UjDNJ6SPw30Yijy+62YrftYGgbuwoiL9hDNGO2LfjgOkglHTBJaZe31uQLLWc5uCzd+7Dgh7RaKMmeuz2Uv7yqm/IEU9jH8cPMR9YRPIhmzg38G2s9ILn27QqW9j1hrFY1V [email protected]

This is the key I got, it's a long time after opening, don't be surprised, no problem, this is the key you need.

 Now you need to log in to your GitHub and add this key,

 

 

Open your GitHub settings interface, find the SSH and GPG keys option, in the upper right corner of the page there is an add new SSH keys click

 

The title here is to let you give your key a name. According to your personal preference, you can use any name, and then fill in the key you copied in the file just now in the big box below. Just save it.

Then you can go back to your Git bash

Then enter the above code to check whether the binding is successful. When you bind for the first time, you will be prompted whether to continue after entering the above code. After entering yes, if it appears : You've successfully authenticated, but GitHub does not provide shell access 。That means that you have successfully connected to GitHub. There are a few simple things to set up next.

Enter the code above, the name should preferably be the same as the one on GitHub, and the email must be the email address registered with GitHub

The order of these two can be reversed, there is no fixed order.

 Next, clone your library to your local computer so that you can upload the code later.

 

After the library is created,  a URL will appear on the web page.

 

Personally, you are used to storing your own files in the d drive, so you need to locate git bash in the d drive first.

 

Enter cd /D in git bash. Note that the disk name must be capitalized. If you do not enter this statement and do not locate git bash, the default local file location is in the c drive.

After the input, /D will appear to indicate that the positioning is successful.

enter after

The URL after git clone is the URL after you successfully created the library


Then open the D drive I located

 

As you can see, there is already a folder created with my library name in the D drive.


Open this folder and create a file of any format, any name in it.

 

Then relocate the location where git put the book, and locate it in the folder of your library.


After entering the ls statement, the function of ls is to view the files in the folder you are currently locating. Now it can be seen that the test file I just created has appeared.


Then enter  git add test.txt

Then enter and then git commit -m "cc" The content in the quotation marks can be changed at will. The meaning of this statement is to give a note to the file you just uploaded, which is convenient for searching and remembering.


After entering the above situation, and then after entering git push origin master, there will be a

 

 

interface, log in to your previously registered GitHub account and click login.

 

If this happens later, it means that the login failed, then you need to enter your GitHub account name

This interface will appear after entering, and then enter your GitHub password again.


A similar interface appears, you can cheer, on behalf of your success.

Now open your GitHub website and find the library you created

 

It is found that the grid today is green, indicating that you have uploaded the file you just created.

After that, you just need to put your code in the corresponding folder of the library, and then use, git add , git commit -m " " , and finally git push origin master to submit your code.

 Also, I feel that the web version of github is more suitable for novice Xiaobai.

Web version:

I have written a tutorial on the use of the github desktop version software before. I feel that the software is used by the big guys. I heard that the web version of Git is blocked. Although I installed the desktop version, I rarely use it after using it for a period of time. The desktop version is almost non-existent, I always upload files directly through the web version. For Xiaobai, the web version is more suitable.

Here I will briefly introduce a basic method of using the web version. If you use the web version, I recommend that people who are not good at English use Google Chrome. The advantage of Google Chrome is that you can translate the current web page into Chinese with one click.

 

After logging in to my homepage, all my branches are on the right side. I created two of them myself, and the middle one is someone else's code that was saved for testing at that time.

If you want to create a new branch, you can click the green button on the right. The method of creating a branch is the same as the desktop version. I'm going to upload the code to the bit branch now.

 

After entering the branch, you can choose, create a new file, or upload a new file. There is a difference between creating a new file and uploading a file here in my opinion.

 

Creating a new file is the same as writing a blog, first give it a name, then copy your code into it.

 

Scroll down and click the green button to upload.


If you click upload file, you can directly upload the .c and .cpp files you wrote before.

 

Click to select a file, then find your file and upload it directly.

However, in fact, the github web version can directly upload folders, but this is a hidden function. If you want to upload a folder, you need to find the folder you uploaded and drag it directly into the dialog box just now.

 

You can directly upload a folder by dragging the folder directly into the dialog box.

If you want to delete a file or folder, github is relatively difficult to find.

 

找到你想要删除的文件夹,点击进入之后找到setting按钮,之后拉到界面的最下边

 

指向的按钮就是删除按钮。

这就是github网页版的简单操作。不知道是不是真的网页版被墙了的原因,我上传经常上传失败,各个步骤的上传失败,多试几次就行了。


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324610272&siteId=291194637