[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

相关推荐
newbe365242 小时前
我们如何使用 impeccable 优化前端界面设计与实现稳定性
前端·人工智能·分布式·github·aigc·wpf
zhanghaofaowhrql7 小时前
Cursor+GitOps:自动化运维新姿势
运维·自动化
一次旅行8 小时前
AI 前沿日报 | 2026年7月3日 星期五
人工智能·github·ai编程
weixin_471383039 小时前
Docker - 05 - 构建流程
运维·docker·容器
夏玉林的学习之路10 小时前
如何远程连接服务器
运维·服务器
风曦Kisaki10 小时前
#Linux数据库管理Day06:主从同步与MaxScale读写分离
linux·运维·数据库
Tipriest_11 小时前
ubuntu创建和更换当前swap大小
linux·运维·ubuntu
雨辰AI12 小时前
生产级实战:人大金仓 V9 标准化运维手册(日常巡检 + 监控告警 + 应急处置)
java·运维·数据库·后端
ejinxian12 小时前
微虚拟机 smolvm 与Docker 容器比较
运维·docker·容器·smolvm
ShiXZ21312 小时前
PDF-OCR文件识别篇(八):配置、运维与排错
java·运维·ocr·dubbo·springboot