生成ssh秘钥
$ git config --global user.name "luoyong"
$ git config --global user.email "[email protected]" ##填写自己的邮箱
3、生成ssh**
$ ssh-****** -t rsa -C "[email protected]" //直接按3次回车选择无密码
4、添加私钥到ssh
$ eval $(ssh-agent -s) //打开ssh-agent
$ ssh-add ~/.ssh/id_rsa //id_rsa为私钥文件名,默认在用户目录下.ssh中
5、将公钥添加到GitLab
Profile Settings->SSH Keys ->Add an SSH key
将~/.ssh/id_rsa.pub中内容添加到SSH Keys中
6、测试
$ ssh [email protected]