1、打开本地git bash 使用下边命令
ssh-keygen -t rsa -C 'xxx@xxx.com' 然后回车(-C 参数是你的邮箱地址)
2、会出现:
Enter file in which to save the key (/c/Users/pc/.ssh/id_rsa):
Enter file in which to save the key (/c/Users/pc/.ssh/id_rsa):
3、如果你的.ssh/id_rsa已经有了,则会出现:/Users/yzq/.ssh/id_rsa already exists.
Overwrite (y/n)?
y 覆盖
n 不覆盖
4、设置6位密码
5、查看本机公钥ssh,获取它
cd ~/.ssh
ls(查看目录是否有id_rsa.pub文件)
查看公钥:cat id_rsa.pub 或者vim id_rsa.pub
6、 例图
7、获取了公钥ssh,到gitlab配置