GitLab添加SSH keys并克隆项目

【电脑环境】
Mac,已安装git

【添加SSH keys】
1、点击访达>终端,进入终端
输入git,如果出现以下提示则证明git安装成功
在这里插入图片描述
2、输入ssh-keygen -t rsa -C ‘[email protected]

ssh-keygen -t rsa -C '[email protected]'

邮箱自定义,然后回车,后面出现这三个提示也可直接回车就行

Enter file in which to save the key (/Users/chenyanchun/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 

出现id_rsa和id_rsa.pub证明ssh密钥生成成功

在这里插入图片描述
3、打开文件,复制SSH密钥

vim ~/.ssh/id_rsa.pub

【克隆项目】
在终端输入git clone 项目链接

在第一次使用SSH连接GitLab的时候会有一个RSA密码指纹确认,输入yes接受即可,以后再连接就不会出现确认提示了。

The authenticity of host 'gitlab.com' can't be established.
ECDSA key fingerprint is SHA256:HbW3g8zUjNSksFbqTiUWPWg2Bq1x8xdGUrliXFzSnUw.
Are you sure you want to continue connecting (yes/no/[fingerprint])? 

猜你喜欢

转载自blog.csdn.net/weixin_46475607/article/details/130089505