配置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
相关推荐
EverydayJoy^v^2 小时前
RH134学习进程——十二.运行容器(1)
linux·运维·容器
b***25112 小时前
电池组PACK自动化生产线的关键流程与核心优势
运维·自动化
哲伦贼稳妥4 小时前
职场发展-遇到以下情况请直接准备后手吧
运维·经验分享·其他·职场和发展
Exquisite.4 小时前
企业高性能web服务器(4)
运维·服务器·前端·网络·mysql
北塔软件4 小时前
北塔方案 | 政府行业IT运维解决方案
运维·it运维·解决方案·政务
cg_ssh5 小时前
Docker 下启动 Nacos 3.1.1 单机模式
运维·docker·容器
修己xj5 小时前
使用 Docker 部署 SQL Server 并导入 .mdb 文件的完整指南
运维·docker·容器
郝亚军7 小时前
ubuntu-18.04.6-desktop-amd64安装步骤
linux·运维·ubuntu
Web极客码7 小时前
CentOS 7.x如何快速升级到CentOS 7.9
linux·运维·centos
一位赵7 小时前
小练2 选择题
linux·运维·windows