centOS无法使用git clone
2019-08-10 本文已影响0人
喜叔z
想从码云上git clone上down一些源码,发现出现以下错误提醒
The authenticity of host 'gitee.com (116.211.167.14)' can't be established.
ECDSA key fingerprint is SHA256:FQGC9Kn/eye1W8icdBgrQp+KkGYoFgbVr17bmjey0Wc.
ECDSA key fingerprint is MD5:27:e5:d3:f7:2a:9e:eb:6c:93:cd:1f:c1:47:a3:54:b1.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'gitee.com,116.211.167.14' (ECDSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
于是想起来git链接需要在码云上配置ssh公钥,点击码云设置
设置.png
生成ssh公钥
1.你可以按如下命令来生成 sshkey:
ssh-keygen -t rsa -C "xxxxx@xxxxx.com"
2.按照提示完成三次回车,即可生成 ssh key。通过查看 ~/.ssh/id_rsa.pub 文件内容,获取到你的 public key
cat ~/.ssh/id_rsa.pub
3.复制生成后的 ssh key,添加到项目中。
4.添加后,在终端(Terminal)中输入
ssh -T git@gitee.com
5.简单的设置
git config --global user.name "yourname"
git config --global user.email "youremail@youremail.com"