[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

相关推荐
biubiubiu070625 分钟前
Vibe Coding
运维
学不完的1 小时前
ZrLog 高可用架构监控部署指南(Prometheus + Grafana)
linux·运维·架构·负载均衡·grafana·prometheus·ab测试
北京智和信通1 小时前
可视・可管・可靠:智和信通赋能清华某院构建新一代监控运维平台
运维·网络监控·网管软件·信创运维·高校网络运维·高校网管
Sean‘1 小时前
AKS 集群离线部署 kube-state-metrics 文档
运维·docker·容器
cyclejune3 小时前
5 个本地 AI Agent 自动化工作流实战
运维·人工智能·自动化·clawdbot·openclaw
Johnstons3 小时前
2026企业网络流量监控与分析工具对比
运维·网络·数据库·网络流量监控·网络流量分析
x-cmd3 小时前
[x-cmd] 一切 Web、桌面应用和本地工具皆可 CLI -opencli
前端·ai·github·agent·cli·x-cmd
IMPYLH3 小时前
Linux 的 dirname 命令
linux·运维·服务器·数据库
桌面运维家4 小时前
DHCP监控:IP冲突诊断与网络稳定运维实战
运维·网络·tcp/ip
徐同保4 小时前
openclaw 的github项目同步到gitee仓库
gitee·github