遇到问题:ssh: Could not resolve hostname github: Temporary failure in name resolution
解决方法:github添加ssh的key
步骤:
cd ~/.ssh
ls
>>id_rsa id_rsa.pub #有这两个文件说明已经添加过ssh key,但一般需要重新生成
ssh-keygen -t rsa -C "你的邮箱地址"
#创建ssh key
#-t 指定密钥类型,默认rsa ,可省略;
#-C 设置注释文字,比如邮箱;
#-f 指定密钥文件存储文件名。
Generating public/private rsa key pair.
Enter file in which to save the key (/home/overlord/.ssh/id_rsa): #Enter回车
/home/overlord/.ssh/id_rsa already exists.
Overwrite (y/n)? y #输入y
Enter passphrase (empty for no passphrase): #Enter回车
Enter same passphrase again: #Enter回车
Your identification has been saved in /home/XX/.ssh/id_rsa
Your public key has been saved in /home/XX/.ssh/id_rsa.pub
The key fingerprint is:
XXXXXX
The key's randomart image is:
+---[RSA XXXX]----+
| |
| XXXxx |
| |
| xXXXXXX |
|XXXXXXXXXXX |
|X X |
|XXXXXXXXX |
|XXXXXXXX |
| XXXXX |
+----[XXXX]-----+
##创建成功
接着复制刚刚生成的密钥,vi id_rsa.pub
,打开文件后全部copy
也可以用这个指令:cat ~/.ssh/id_rsa.pub
下面登录你刚刚输入的邮箱所创建的github账号,按照如下步骤操作:
至此添加成功!
再次测试ssh -T git@github.com
Hi XX! You've successfully authenticated, but GitHub does not provide shell access.
问题解决~