centos 生成 ssh-key github 连接 配置

我的环境是阿里云centos7。

1、生成ssh-key,填入自己的邮箱

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

2、进入ssh目录

cd ~/.ssh

3、查看文件

ls

会看到列举出了有id_rsaid_rsa.pub
4、复制一下id_rsa.pub文件内容

cat id_rsa.pub

5、打开github中的SSH and GPS keys选项,新增SSH key,添加完成需要再次输入github密码验证。
6、在自己的终端测试一下吧,使用ssh -T [email protected]

[root@iZuf60c5nb7ulqwzl2jwbsZ .ssh]# ssh -T [email protected]
The authenticity of host 'github.com (13.229.188.59)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
RSA key fingerprint is MD5:16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,13.229.188.59' (RSA) to the list of known hosts.
Hi solocao! You've successfully authenticated, but GitHub does not provide shell access.
[root@iZuf60c5nb7ulqwzl2jwbsZ .ssh]# ssh -T [email protected]
Warning: Permanently added the RSA host key for IP address '13.250.177.223' to the list of known hosts.
Hi solocao! You've successfully authenticated, but GitHub does not provide shell access.

你可能感兴趣的:(centos 生成 ssh-key github 连接 配置)