前言#
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