Article directory
Preface
The main purpose of this article is to describe gitlab account registration, login function, and how to generate ssh key and add ssh key to gitlab. Use the git tool to pull the code on gitlab locally to verify whether the ssh function is effectively configured.
Register an account
Step 1: Open the gitlab login page through the URL https://gitlab.com/users/sign_in, and click register now below.
Step 2: Jump to the registration page and fill in the relevant information. Step 3: Click register to complete registration
Login
Return to the login page and log in to gitLab through the registered account and password.
Add SSH
Step 1: Open the git bash tool and generate ssh-key through the command (run the command and press Enter until the key is generated): ssh-keygen -t rsa -C ‘[email protected]’
Step 2: The generated key is usually in the folder C/Users/xxxx/.ssh. Enter the folder and open the id_rsa.pub fileStep 3: Copy the ssh key
Step 4: Log in to gitLab, click the drop-down menu in the upper right corner, click Preferences Step 5: Click SSH Keys and copy the id_rsa.pub file Copy and paste the key in to the position in the picture, and click Add key
At this point, we can pull and upload the code through git commands.
For the installation and configuration of git tools and TortoiseGit tools, refer to the following documents:
Git&TortoiseGit tool installation
Verify configuration
Verify whether the above configuration is valid by successfully pulling the code.
Step 1: Created your own project on gitlab
Step 2: Find the project you created by clicking Your Work
Step 3: Enter the project, Copy Clone UrlStep 4: Pull the code to the local through the TortoiseGit tool.
Note:
If this is the first time you connect to gitlab through ssh, you will be prompted whether you want to connect to the host when downloading the code. Click to confirm. . A successful connection will generate a known_hosts file in the .ssh folder
This shows that the above configuration is valid. You can happily enable code editing, uploading and other functions.