配置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
相关推荐
陈葛杰10 分钟前
VMware 安装 Rocky Linux 9.6(Minimal 版)超详细图文教程|轻量 · 安全 · 生产级
linux·运维·服务器
时间之里25 分钟前
【linux】:目录解析
linux·运维·服务器
安得权27 分钟前
使用GitHub CLI(gh)来创建 GitHub Issue
github·issue
Student_Zhang29 分钟前
一个管理项目中所有弹窗的弹窗管理器(PopupManager)
前端·ios·github
qq_317620311 小时前
001:Linux 命令速查手册
linux·运维·服务器
Coder_Boy_1 小时前
分布式系统设计经验总结:金融vs电商的核心差异与决策思路
java·运维·微服务·金融·电商
biubiubiu07061 小时前
Ansible自动化
运维·自动化·ansible
Python大数据分析@1 小时前
使用Dify搭建工作流,实现自动化商品采集分析
运维·python·自动化·网络爬虫
code tsunami1 小时前
如何将 Helium 与 CapSolver 集成,实现无缝 CAPTCHA 自动化解决
运维·数据库·人工智能·爬虫·python·自动化
哎呦喂1 小时前
插件如何实现行内代码补全?
github