1. 其实就保证本地的公钥和页面服务器端的一致
2. 碰见下面的问题时,要全打yes, 不然默认时no,导致下载失败。
git clone git@gitlab.hhhh.com:resource/project.gitCloning into 'location'...
The authenticity of host 'com:resource.com (120.40.151.8)' can't be established.
ECDSA key fingerprint is SHA256:quD2TDwxl8687vMOUUBGXlwZhjxDTu7eVF43ojAu1Pw.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'gitlab.hhhh.com,121.40.151.8' (ECDSA) to the list of known hosts.
remote: Counting objects: 35, done.
remote: Compressing objects: 100% (32/32), done.
remote: Total 35 (delta 2), reused 0 (delta 0)
Receiving objects: 100% (35/35), 54.21 KiB | 0 bytes/s, done.
Resolving deltas: 100% (2/2), done.
Checking connectivity... done.
3. ssh:The ECDSA host key for gitlab.xxxx.com has changed问题
ssh会把你每个你访问过计算机的公钥(public key)都记录在~/.ssh/known_hosts。当下次访问相同计算机时,会核对公钥。如果公钥不同,ssh会发出警告,避免你受到DNS Hijack之类的攻击。因此我们现在只需要删除knows_hosts文件中所对应的公钥即可
方法一
1、ssh-keygen -F 计算机名称(IP)
2、得到gitlab.XXX.com的公钥,以及在所在的行数
3、去known_hosts中找到对应的公钥将其删除
方法二
1、 粗暴点,直接删除known_hosts文件,重新生成一个
包括id_rsa, id_rsa.pub, known_hosts三个文件。
2、执行下面命令, 一路回车,不用设置密码
ssh-keygen -t rsa -C "xxx@yyy.com(你自己的账号)"
3、查看公钥,输入命令,得到公钥
cat ~/.ssh/id_rsa.pub 或vi ~/.ssh/id_rsa.pub
4、复制,粘贴到网页上的add key里即可