个人博客https://www.yotroy.cool/,欢迎关注我哦~
============================================================
前言
ssh key又过期了,每次重新添加都要回看documentation,自己写一个方便记的。
步骤
以Ubuntu为例
$ ssh-keygen -t rsa -b 4096
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
$ #输入名字
$Enter passphrase (empty for no passphrase): 输入密码
$Enter same passphrase again: 再次输入密码
如果在输入名字处直接回车会输出如下
Your identification has been saved in /root/.ssh/id_rsa
Your public key has been saved in /root/.ssh/id_rsa.pub
The key fingerprint is:
SHA256: ....code..... root@system
直接cat指令
cat ~/.ssh/id_rsa.pub
输出直接复制到GitHub的Add new SSH Key中即可。
测试
$ ssh -T git@github.com
问题
可能存在国内无法连接问题,可尝试更换dns