Configure username and email
- Use the git command line input:
- git config --global user.name “your username”
- git config --global user.email “your email address”
Produce a new SSH key
- Use the git command line input:
- ssh-keygen -t rsa -C “your email address”
- The result is as follows:
Add the produced SSH key to ssh-agent
-
Use the git command line input:
- ssh-add path
path is the path of id_rsa, such as: /c/Users/Administrator/.ssh/id_rsa
-
If the add command fails, execute the ssh-agent bash command first
Add to gitlab account
- Use a text editor to open the rsa_pub file (in the same folder as the id_rsa file), and copy all the contents to the SSH Keys in the gitlab account, as shown below:
After the configuration is complete, you can use the ssh protocol to pull and the last project to git
- As shown below: