[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

相关推荐
齐翊21 小时前
分享一个在 Claude Code 里 [同时] 用多个 ApiKey 的方法
程序员·github·agent
A_Lonely_Cat21 小时前
记一次 GitHub 幽灵协作者大清洗:强制重写 Git 历史与穿透 CDN 缓存实践
git·github
极光技术熊2 天前
Spring AI 从入门到精通:构建你的 AI 开发知识体系
后端·github
SkyWalking中文站2 天前
认识 Horizon UI · 1/17:SkyWalking 新一代可观测性控制台
运维·前端·监控
用户39483951075532 天前
怎么让我的 Agent 真正"懂"我?——关于记忆、经验学习与预测的一些真实体验
github
雪梨酱QAQ2 天前
Kubeneters HA Cluster部署
运维
远航_2 天前
git submodule
前端·后端·github
江华森2 天前
Spring Cloud 微服务全栈实战:从 Eureka 到 Docker Compose 一文贯通
运维
江华森2 天前
Matplotlib 数据绘图基础入门
运维
江华森2 天前
NumPy 数值计算基础入门
运维