[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

相关推荐
Yupureki28 分钟前
《MySQL数据库基础》1. 数据库基础
c语言·开发语言·数据库·c++·mysql·oracle·github
火车叼位1 小时前
Docker Compose 网络原理与实战:同一 Compose 服务间如何稳定通信
运维·docker·容器
白狐_7982 小时前
从零构建飞书 × OpenClaw 自动化情报站(三)
运维·自动化·飞书
人间打气筒(Ada)4 小时前
mysql数据库之DDL、DML
运维·数据库·sql·mysql·dba·dml·dql
SongYuLong的博客4 小时前
Linux IPC进程通信几种方法
linux·运维·算法
yiwenrong5 小时前
安全审计-Ubuntu-ufw防火墙
linux·运维·ubuntu
小比特_蓝光5 小时前
Linux:基本指令
linux·运维·服务器
hnlgzb5 小时前
如果获取deepseek的api key?
运维
逛逛GitHub5 小时前
清华团队开源!1 键生成多 Agent 智能体 AI 课堂。
github
研究点啥好呢6 小时前
3月15日GitHub热门项目推荐 | 当AI拥有记忆
人工智能·python·github·openclaw