Detailed usage of github novices (recommended collection!!!)

If you are a Coder, but you don't know Github, then I think you are not a novice-level Coder, because you are not a real Coder at all, you are just a Code porter. It shows that you are not good at breaking through yourself at all! The reason for this is very simple. Many excellent codes and various framework source codes are stored in github!

First of all, let me give a brief introduction to GitHub. GitHub is a remote warehouse. The popular understanding of remote warehouse is a place where you can save your own code. In actual development, a project is often developed by multiple people. Then there needs to be a place where the unified code is saved, and GitHub plays a role in sharing and summarizing the code.

github login and registration

Official login page: https://github.com/login

Registration page: https://github.com/join?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F&source=header-home

Relatively speaking, registration is still very simple. You only need one email address. Just write qq email in the email address. If you forget the password in the future, you can retrieve the password by email.

The official website is all in English. At present, no Chinese version has been found. For students who are not good at English, it is recommended to use Google Chrome. Google Chrome can translate webpages into Chinese and it is very convenient to use.

After logging in, here we can create our own library.

Some explanations of creating the library after translation into Chinese have been written very clearly.

What needs to be noted here is that the library is divided into two types, divided into public and private. The above explanation is very clear, you can choose by yourself.

After creating your own library, let your computer clone a library you created, and the code on your computer will be synchronized to the library you created on GitHub. In order to achieve this, you need to install a software, Git Bash.

Detailed gitbash installation steps

git bash is a command line tool under Windows.
Based on the msys GNU environment, there is a git distributed version control tool.
Mainly used for git version control, upload and download project code.

GitHub official website: http://git-scm.com/download/win
First enter the GitHub official website and download the version suitable for your computer

Sometimes it is very slow when downloading. Here I will give you a download that I downloaded. Although it is not the latest version, it is definitely usable.

Link: https://pan.baidu.com/s/1sN5a26sMOEVSGhD9G33Pwg
Extraction code: aunu

I won’t take screenshots for you in the next step. In short, it’s all the way to Next!

After downloading, just find a folder and right click and you will find a git bash, which proves that the installation is complete.

Common commands for gitbash

git init initializes git. Only after initialization can you use git related commands.
git clone to get the remote project and download it locally. The address of the remote library will be provided in the GITHUB project.
git status View the difference between the local modification and the server.
git add. Add these difference files so that they can be submitted.
git commit -m "comment here" Commit the changes to the server.
git checkout master changes to the master repository.
git pull gets the latest changes from the server to the local.
git merge local master merges the local local to the remote master.
git push origin master is officially submitted to the remote master server.
There are also "git tag", "git diff", "git show", "git log", "git remote" and so on.

Get ssh key

Open the input: ssh-keygen -t rsa -C "git account"
after inputting, all the way to Enter (confirm) is fine

The above screenshot proves successful. At this time, open the following address:
id_rsa.pub is the ssh key we need

Note : Some may have been generated before, and this error will be reported.

Error resolution: https://blog.csdn.net/weixin_43888891/article/details/112429980

Bind ssh key

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

Copy the entire id_rsa.pub content

Added successfully

After that, you can go back to your Git bash and
enter: ssh -T [email protected]
and then enter the code above to check whether the binding is successful. If you select yes after the input, it means that it is successful.

Next, you need to simply set up some things.
git config --global user.name "git account"
git config --global user.email "git mailbox, the mailbox when registering"

Code clone

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

Link: https://github.com/

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, and this address is the code address.
The git clone command will use it

Then start to choose the file storage location.

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

git clone address (this address is the code address on the page of the library just created)

Sometimes you will be asked to enter your account password or something during the execution of the command. Just don't make a mistake!

As you can see, our library file already exists in the specified directory

Test submission

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

Then right-click git bash in this file and enter the black box
git add our new file

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

Then enter git push origin master
this means success

Now open your GitHub website and find the library you created.
The file was uploaded successfully.



Like it!

Hope more people can see it!

Guess you like

Origin blog.csdn.net/weixin_43888891/article/details/112385076