. 1 root root 1675 Dec 18 04:01 /root/.ssh/id_rsa
-rw-r--r--. 1 root root 397 Dec 18 04:01 /root/.ssh/id_rsa.pub
其中`id_rsa` 是私钥,`id_rsa.pub` 是公钥,我们要把公钥的内容上传到`github` 。
查看公钥并复制:
[root@localhost git-2.15.1]# cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEArPMU4FnFQii0SYmUg2USSV6FId8eILptRew7iQqDyEtZIe6cKB6Z8Rkqk3ZKd8VclbAKKRJZCnwR6wHHXmYtm/i19DmGOHDuxuY+MkWtWB3bFsQKlQe4OaAoCvLqlRS7S+3Jppw5Uu5zZf85AABmutbGZq0/Fk*lbjJZ+uCchBf3VttiWD0gnyTjubYiBc4i5StOefGrfogTYz22dNZodguwcBb83v09zqp5l46WeIWG33sse+Me4R5B5Q== maqian@dyxmq.cn
打开github,右上角`Settings` 进入设置界面,在`SSH and GPG keys` 栏新建一个`ssh key` :![](https://i.maqian.xin/2017/12/1.png)
填入复制的密钥对,`Title` 可以随便写:
![](d:/Users/maqian/Pictures/wordpress/æç« å
容/git/2.png)![](https://i.maqian.xin/2017/12/2.png)
测试是否验证成功:
[root@localhost git-2.15.1]# ssh -T git@github.com
The authenticity of host "github.com (192.30.255.113)" can"t be established.
RSA key fingerprint is 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
Hi madawang! You"ve successfully authenticated, but GitHub does not provide shell access.
此处评论已关闭