一、生成.ssh文件:
1、安装Git工具完成
已成功安装Git,如果没有安装,则详见:https://blog.csdn.net/weixin_43184774/article/details/103798736
2、在电脑桌面,鼠标右键,选择"Git Bash Here",打开Git命令窗口

3、在Git命令窗口中配置用户,输入如下命令:
git config --global user.name "blkj"
其中:"blkj"是你自己要填写的用户名

4、继续在Git窗口中配置邮箱,输入如下命令:
git config --global user.email "blkj@boranet.com.cn"
其中:"blkj@boranet.com.cn"是你自己的邮箱地址

5、此时会在C:\Users\Administrator目录下生成.gitconfig配置文件(此文件不能删除)

6、查看.gitconfig配置文件里的内容

7、继续在Git命令窗口中输入如下命令,即可生成SSH公钥和私钥
ssh-keygen -t rsa -C "blkj@boranet.com.cn"

8、进入C:\Users\Administrator.ssh目录下,查看生成的SSH密钥

9、在Git窗口中输入如下命令,可以查看公钥和私钥
cat ~/.ssh/id_rsa.pub

二、将.ssh文件配置到gitLab后台:
1、.登录后gitLab,点击用户头像,弹出用户信息框,点击setting进入。

2、找到.ssh

3、将.id_rsa.pub文件内容复制到里面;


网友评论