7.1 Creating the Github Library

If you have no account, register an account first. In order to use Github to host your own project code, you need to create a repository first. The repository can be public and private. The public repository is free, and the private repository is charged

Figure 1

Click the New Repository button. If you are using it for the first time, you will be asked to confirm the email address. The next line is a description of the repository. The next line is a description of the repository. The next line is a README file in the repository. The Add Gitignore button below allows you to select the language you want to use for your project. Here I select it, but I don’t select the License. Click “Create Repository”.

Figure 2 Creating a library

Once the repository is successfully created, the following screen appears and you can click readme.md to compile the file.

Figure 3

Figure 4.

7.2 configuration

7.2.1 Git configuration

Git bash: ssh-keygen -t rsa -c “Email address” ssh-keygen does not contain Spaces. GitHub email: The email following this command is your registered email. Path selection: After running this command, a message is displayed asking you to select the path for generating ssh-key. You can press Enter to select the default path. The generated ssh-key is in the default path.

Password confirmation: here we do not use the password for login, using the password is too troublesome, directly enter. Of course, if you want to use a password to log in, enter the password (it can’t be too short) and press Enter. The screenshot of operation is as follows:

Figure 5

Find the generated Key in the default path shown above. My default path is “C:\Users\ ouxiaolu.ssh”. If you don’t know your default path, type “PWD”.

3. Use the Notepad or UE to open the id_rsa.pub file and copy the contents in the file to the GIT server. Logging in to GitHub: Log in to GitHub and select Settings. The following screenshot is displayed:

Figure 6.

Select SSH and GPG keys on the left. The following screenshot shows the operation:

Figure 7.

4. Click “New SSH Key” on the right and enter the previously generated key in the displayed input box. The screenshot is as follows:

Figure 8.

After input, click “Add SSH Key” 5. Click “Add”, the screenshot is displayed as follows:

Figure 9.

At the same time, the email we configured will also receive the corresponding email, as shown in the screenshot below:

Figure 10.

This way, our local key is added to GitHub. Of course, if your Git server is set up by your company or yourself, you just need to log in to the corresponding Git server and add your locally generated key to it.

6. Verify that the configuration is successful by running the SSH -t [email protected] command. Success Tip: If “Hi ouxiaolong! You’ve successfully authenticated, but GitHub does not provide shell access.”

Figure 11.

We need to set up a user name and email that will display the code uploader on GitHub when uploading the repository to GitHub. Git config –global user.name “XXX” // Set the user name git config –global user.email “email” // Set the email address. At this point, our Git client is configured and our local key has been successfully uploaded to the Git server.

Figure 12

7.2.2 Using Git + Github

So far, we have finished configuring Github, Git related operations do not understand the previous several chapters, here will not be described. To host our project, we have just created a repository on Github called Smart_Home, so we will now create a directory locally to manage this repository.

 creates a directory called Git

Figure 13

 right-click the directory and a menu appears with Git Bash Here, click on it.

Figure 14

 then opens our terminal on this directory.

Figure 15

 this time enters git init to complete the initialization. Git init//

Figure 16

Command: git remote add origin [email protected]: Ouxiaolong/Smart_Home git

Figure 17

Git pull [email protected]: Ouxiaolong/ smart_home.git

Figure 18

 uploads a local file to the repository

First run the git add command as follows: git add

Figure 19

If you want to submit the specified file, you can write the file name. After executing the add command, you need to execute the submit command as follows:

Git commit -m “Version (custom)”

Figure 20

-m is followed by a prompt message. This prompt message must be written, not only for the rule, but also for us to record the process of our submission. It is very useful to write clearly why we submitted or what we modified. git push [email protected]: Ouxiaolong/Smart_Home.git

Figure 21

If the following information is displayed on Github, the IP address is successfully added.

Figure 22

That’s all we need to do.