[yotroy.cool]记一次将SSH公钥添加到GitHub

个人博客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

相关推荐
晚风吹人醒.40 分钟前
SSH远程管理及访问控制
linux·运维·ssh·scp·xshell·访问控制·远程管理
修己xj1 小时前
解决Github QQ邮箱注册难题:绕过“Unable to verify your captcha response”错误
github
necessary6532 小时前
使用Clion查看linux环境中的PG源码
linux·运维·服务器
江湖有缘3 小时前
Jump个人仪表盘Docker化部署教程:从0到 搭建专属导航页
运维·docker·容器
FL16238631294 小时前
win11+WSL+Ubuntu-xrdp+远程桌面闪退+黑屏闪退解决
linux·运维·ubuntu
AI首席情报员_阿布4 小时前
2026 GitHub 最火的 10 个 AI Agent 框架:普通开发者的选型指南
github
AOwhisky4 小时前
Linux逻辑卷管理:从“固定隔间”到“弹性存储池”的智慧
linux·运维·服务器
05大叔5 小时前
大事件Day02
运维·服务器
C Yu小白6 小时前
Linux系统调用与文件操作详解
linux·运维·服务器
ZFB00016 小时前
【麒麟桌面系统】V10-SP1 2503 系统知识——常见用户组简介
linux·运维·kylin