Xiaobai Training Camp Lesson 4 - Code
How to create a new project from the command line (created over SSH)
As mentioned in the previous lesson, since the system will choose to create based on HTTPS by default, if you select or click SSH, the steps will be slightly different. This lesson will introduce the creation of projects based on SSH from the command line in detail.
If a project has been created and SSH is clicked, the code warehouse page of [Personal Center] is like this. Clicking [HTTPS] or [SSH] will generate corresponding different links.
To create based on SSH, we need to configure the key first.
1. Generate public key
Right-click on the desktop and select [Git Bash Here].
DOS window pops up.
Input: git config --global user.name "Enter your username" (this username is the email address you registered on the Qizhi open source platform).
Press Enter.
Input: ssh-keygen -t rsa -C "email account", without setting a password, click enter three times in a row;
This will generate your ssh key. Find the following file in the C:\Users\Administrator{personal computer name}.ssh directory, and open the id_rsa file in Notepad to view the generated ssh key information.
2.Add public key
Log in to the Qizhi platform and click [Settings] under your profile picture.
Click [SSH/GPG Keys] > [Add Keys]
The key name can be named arbitrarily. "Key content" can copy and paste the key in the id_rsa file.
Click the [Add Key] button to generate key , and the key is added successfully at this time.
3.Enter the command
Create a folder with the same name as the project locally, open the folder and right-click [Git Bash Here] to enter the DOS window.
Follow the prompts under [Create a new project from the command line] on the page, enter DOS in turn and press Enter.
Until the last command "git push -u origin master" is entered.
After pressing the Enter key, the execution is complete.
At this point, we refresh the project page, and the code warehouse is built~