-Liao Xuefeng official website understand. The short steps can be seen directly in the final summary.
Let alone install Git.
Step 1: We first need to create a local version library (actually a folder).
You can right-click the new folder directly, or right-click to open the Git bash command line window and create it through the command.
Now I create a new test folder on the desktop through the command line (you can also create this folder anywhere else) and enter this folder.
Step 2: Convert this folder into a Git-manageable repository through git init command.
At this time, you will find one more. Git folder, which git uses to track and manage version libraries. If you can't see it because it is a hidden file by default, then you need to set it to make the hidden file visible.
Step 3: At this time, you can paste your project into this local Git repository (you can check your current status through git status after pasting), and then add the project to the repository through git add (or git add). Add all the files in this directory to the warehouse, note that the points are separated by spaces). In this process, you can actually use git all the time.
Status can view your current status.
Here's a hint. Although you have pasted the project, you haven't added it to the Git repository, and then we will add all the copied projects to the repository through git add.
Step 4: Submit the project to the warehouse with git commit.
The quotation marks after -m are the comments submitted this time. You don't have to write this, but you'd better write it, or you'll get an error. Details yourself Google. Well, our local Git warehouse is finished, and now it's time to connect to the remote warehouse (that is, to connect to Github).
Because the transmission between the local Git warehouse and Github warehouse is encrypted by SSH, the following contents need to be set when connecting:
Step 5: Create an SSH key. First, check whether there is one. Ssh directory in your C drive user directory. If yes, check whether there are two files, id_rsa and id_rsa.pub If yes, skip to the next step. If not, create it with the following command.
$ ssh-keygen-trsa-c "youremail @ example.com" and return all the way. At this time, you will be. Ssh directory under the user.
Step 6: Log in to Github, find the icon in the upper right corner, open the settings inside, then select the SSH and GPG keys inside, click the new SSH key in the upper right corner, then fill in the title casually, copy the contents of id_rsa.pub into the key content box below the title, and finally click Add SSH key, thus completing the encryption of SSH key. The specific steps can also be seen below:
Step 7: Create a Git warehouse on Github.
You can directly click New Repository to create it. For example, I created a warehouse for TEST2 (I can't create a warehouse for TEST because I already have a warehouse for testing).
Step 8: After creating the Git warehouse on Github, we can associate it with the local warehouse. According to the prompt on the created Git warehouse page, you can enter:
$ git adds origin /guyibang/TEST2.git remotely.
Note that origin is followed by the address of the warehouse created on Github.
Step 9: After association, we can push all the contents of the local library to the remote warehouse (namely Github) in the following ways:
$ git push -u origin master Since the newly-built remote warehouse is empty, the parameter -u should be added. When there is content in the remote warehouse, the next time you upload content from the local warehouse, you only need to do the following:
The process of $ git push origin master uploading the project may take some time, and after completion, it is like this:
At this time, if you refresh your Github page and enter the new warehouse, you will find that the project has been uploaded successfully:
At this point, the whole process of uploading local projects to Github has been completed.
In addition, there is another pit to pay attention to, that is, when creating a remote warehouse in step 7 above, if you check Initialize this warehouse with a readme file (that is, automatically create a readme file for you when creating the warehouse), then when you push the contents of the local warehouse to the remote warehouse in step 9, you will get an error.
Let's push some mistakes from refs to/guybang/test2.git.
This is because the readme file in the newly created warehouse is not in the local warehouse directory. At this point, we can merge the following contents through the following command:
$ git pull-rebase original host
At this time, one more push will succeed.
Summary: In fact, uploading local projects to Github only takes the following steps.
1. Create a version library (that is, a folder) locally and turn it into a Git warehouse through git init;
2. Copy the project into this folder, and then add the project to the warehouse through git add.
3. Submit the project to the warehouse through git commit -m "tagging content";
4. After setting the SSH key on Github, create a new remote warehouse, and associate the local warehouse with the remote warehouse through GitRemote Add Origin/Guyibang/Test2.git;
5. Finally, push the local warehouse project to the remote warehouse (namely GitHub) through git push -u origin master; (If the readme file is automatically created when building a new remote warehouse, an error will be reported. For the solution, see above).
Here is just a summary of some basic operations of the Git upload project, and further study is needed to better use Git.