配置ssh-key连接github

GitHub 通过在 2022 年 3 月 15 日删除旧的、不安全的密钥类型来提高安全性。

具体内容参考如下链接
https://docs.github.com/zh/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

mac配置

shell 复制代码
ssh-keygen -t ed25519 -C "devops@game.vip"

vim ~/.ssh/config
Host github.com
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_ed25519

生成后将公钥添加至个人github账号里

shell 复制代码
cat ~/.ssh/id_ed25519.pub 

文章中有个关键提示,我mac没有给秘钥配置密码 但没有报错,ubuntu去掉了 不然那会报错

如果你选择不向密钥添加密码,应该省略 UseKeychain 行。

如果看到 Bad configuration option: usekeychain 错误,请在配置的 Host *.github.com 部分添加额外的一行。

ubuntu配置

shell 复制代码
# 生成公钥,这里邮箱随用于区分公钥所属账号
ssh-keygen -t ed25519 -C "devops@game.vip"

# 配置
Host github.com
  AddKeysToAgent yes
  IdentityFile ~/.ssh/id_ed25519
相关推荐
有谁看见我的剑了?7 小时前
在Linux和Windows上查看 块存储的WWN号
运维·服务器
lihao lihao7 小时前
linux的基本命令
linux·运维·服务器
bloglin999997 小时前
centos配置域名解析
linux·运维·centos
旺仔Sec8 小时前
2026年中银杯湖北省职业院校技能大赛高职组区块链技术应用任务书
运维·区块链
徐小夕@趣谈前端8 小时前
【推荐】jitword协同文档新增AI公文助手,一键生成红头文件
vue.js·人工智能·开源·编辑器·github
如若1238 小时前
连接远程ARM服务器 (使用 SSH FS)
服务器·arm开发·ssh
Allen_LVyingbo8 小时前
用Python实现辅助病案首页主诊断编码:从数据清洗到模型上线(上)
开发语言·python·github·知识图谱·健康医疗
STCNXPARM8 小时前
Linux-ARM-GIC interrupt子系统深度剖析
linux·运维·arm开发·gic·中断子系统
Jing_jing_X8 小时前
AI分析不同阶层思维11:计算服务器成本
运维·服务器·架构·提升·薪资
AC赳赳老秦8 小时前
ELK栈联动:DeepSeek编写Logstash过滤规则与ES日志分析逻辑
运维·前端·javascript·低代码·jenkins·数据库架构·deepseek