[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

相关推荐
IT成长日记1 小时前
【Docker基础】Docker数据持久化与卷(Volume)介绍
运维·docker·容器·数据持久化·volume·
物联网老王3 小时前
Ubuntu Linux Cursor 安装与使用一
linux·运维·ubuntu
艾伦_耶格宇5 小时前
【ACP】阿里云云计算高级运维工程师--ACP
运维·阿里云·云计算
一位摩羯座DBA6 小时前
Redhat&Centos挂载镜像
linux·运维·centos
油泼辣子多加6 小时前
2025年06月30日Github流行趋势
github
ai小鬼头6 小时前
AIStarter如何快速部署Stable Diffusion?**新手也能轻松上手的AI绘图
前端·后端·github
cui_win7 小时前
【网络】Linux 内核优化实战 - net.core.flow_limit_table_len
linux·运维·网络
风清再凯7 小时前
自动化工具ansible,以及playbook剧本
运维·自动化·ansible
深圳安锐科技有限公司7 小时前
深圳安锐科技发布国内首款4G 索力仪!让斜拉桥索力自动化监测更精准高效
运维·安全·自动化·自动化监测·人工监测·桥梁监测·索力监测
猫头虎7 小时前
猫头虎 AI工具分享:一个网页抓取、结构化数据提取、网页爬取、浏览器自动化操作工具:Hyperbrowser MCP
运维·人工智能·gpt·开源·自动化·文心一言·ai编程