~/vvd_git$ ssh-keygen -t rsa -C "zywvvd@mail.ustc.edu.cn" Generating public/private rsa key pair. Enter file in which to save the key (/home/zywvvd/.ssh/id_rsa): Created directory '/home/zywvvd/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/zywvvd/.ssh/id_rsa. Your public key has been saved in /home/zywvvd/.ssh/id_rsa.pub. The key fingerprint is: SHA256:klt1J9JxcGBj7xgB5dC1cXsQmK9ioOhInLRgqKppO8k zywvvd@mail.ustc.edu.cn The key's randomart image is: +---[RSA 2048]----+ | o+p+=o+. | | B.Bo+ o | | = *.+ . . | |. o = *. . | |oo . . u.. | |* + . . | |+*.. . . | |*E . . . | |Ooo | +----[SHA256]-----+
得到类似上述输出即为创建成功。得到的文件放在~/.ssh文件夹中。
设置Github
登陆github
在settings中设置 ‘SSH and GPG keys’
添加new SSH key—— 设置名字并将.ssh 文件夹中isa.pub公钥文件的内容复制进去
测试SSH秘钥
执行命令:
1
ssh -T git@github.com
输出结果:
1 2
Warning: Permanently added the RSA host key for IP address '52.74.223.139' to the list of known hosts. Hi zywvvd! You've successfully authenticated, but GitHub does not provide shell access.