[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

相关推荐
放下华子我只抽RuiKe540 分钟前
从零构建高精度 AI Agent Skill:Tech Blog Generator 实战指南
人工智能·prompt·github·ai agent·skills·openclaw·development
RisunJan1 小时前
Linux命令-md5sum(计算和校验文件报文摘要的工具程序)
linux·运维
抹茶咖啡1 小时前
IT运维的365天--042 骚操作之--用IPSec给远程桌面上把锁
运维·网络·it运维
王琦03181 小时前
第三章 linux文件类型和根目录结构
linux·运维·服务器
minji...1 小时前
Linux 文件系统 (三) 软连接和硬链接
linux·运维·服务器·c++·算法
2401_884662101 小时前
GitHub镜像站搭建全攻略大纲
github
散峰而望2 小时前
【基础算法】从入门到实战:递归型枚举与回溯剪枝,暴力搜索的初级优化指南
数据结构·c++·后端·算法·机器学习·github·剪枝
好像不对劲2 小时前
【docker】win10 wsl docker不能挂GPU
运维·docker·容器·wsl
落日漫游3 小时前
MySQL双活与备份:高可用实战指南
运维
江畔何人初3 小时前
Docker、containerd、CRI、shim 之间的关系
运维·docker·云原生·容器·kubernetes