1.下载Git Git - Downloading Package
安装后,打开git bash命令窗口
![](https://img-blog.csdnimg.cn/161839adb9c640489388a3bd0fec1573.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA57qv5rSB55qE5LiA56yR,size_6,color_FFFFFF,t_70,g_se,x_16)
![](https://img-blog.csdnimg.cn/5a7ee1eeaa394671a4a9222165cfd164.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA57qv5rSB55qE5LiA56yR,size_17,color_FFFFFF,t_70,g_se,x_16)
2.添加用户名和邮箱
$ git config --global user.name "xxx"
$ git config --global user.email "xxx@xxx.com"
3.生成ssh密钥
$ ssh-keygen -t rsa -C "yourmail@example.com"
4.如果以前有密钥
ssh-keygen -t rsa -C "your.email@example.com" -b 4096
5.查看生成的密钥
cat ~/.ssh/id_rsa.pub
6.注册并登录GitLab,打开id_rsa.pub文件,将生成的密钥粘贴到GitLab中,添加ssh