GitLab配置SSH Keys
-
打开本地git bash,使用如下命令生成ssh公钥和私钥对:
ssh-keygen -t rsa -C 'xxx@xxx.com' (-C 后参数是邮箱地址)
-
然后回车,直到出现:Enter file in which to save the key (/Users/xxx/.ssh/id_rsa),再次回车;
-
如果你的.ssh/id_rsa已经存在,则会出现:/Users/xxx/.ssh/id_rsa already exists.
Overwrite (y/n)? y
输入:y (重新覆盖);输入:n (不覆盖) -
设置密码;
-
查看本机ssh公钥,获取复制它
cd ~/.ssh ls(查看目录是否有id_rsa.pub文件) 查看公钥:cat id_rsa.pub 或者vim id_rsa.pub
-
将复制到的本机ssh公钥,粘贴到GitLab网页User Setting下的SSH Keys中的Key文本框内,填写完成信息后Add key即可。