配置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
相关推荐
whysqwhw1 分钟前
KuiklyUI的ViewRef设计
github
R-G-B39 分钟前
【P1】win10安装 Docker教程
运维·docker·容器
爱莉希雅&&&1 小时前
DNS分离解析案例
运维·网络·dns
Y淑滢潇潇1 小时前
RHCE Day2 时间管理服务器 NFS服务器
linux·运维·服务器
半熟的皮皮虾2 小时前
因需写了个内网运维专用的IP地址管理工具,有点不同
运维·服务器·tcp/ip
snakecy2 小时前
常用命令记录
linux·运维·github
刘一说3 小时前
深入理解 Spring Boot Actuator:构建可观测性与运维友好的应用
运维·spring boot·后端
洛卡卡了3 小时前
Typora + PicGo + 阿里云 OSS:一套自己的图床方案
github·设计
kyle~3 小时前
计算机网络---安全外壳协议(SSH,Secure Shell)
运维·计算机网络·安全·ssh
逛逛GitHub3 小时前
本周 6 个最火火火火 GitHub 项目,AI 杀疯了。
github