配置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
相关推荐
IT爱学堂3 分钟前
新版Linux零基础入门到高手Rocky版本-替换CentOS(完结)
linux·运维·centos
蒸蒸yyyyzwd32 分钟前
cpp选手秋招学习笔记day24-cs144项目总结
运维·服务器·网络
ang78437 分钟前
日常高频使用的 Ansible 命令,按使用频率和场景整理。
linux·运维·服务器
七牛开发者1 小时前
拆解 dsh:Session 的事件溯源与状态重建
javascript·github·agent
赵庆明老师1 小时前
用同一个用户登录宝塔面板的ftp与Linux的sftp
linux·运维·服务器
山君爱摸鱼2 小时前
堡垒机远程服务器故障收集
运维·服务器
不会就选b2 小时前
Linux之socket编程(六)----TCP-->模拟shell命令
linux·运维·tcp/ip
Elastic 中国社区官方博客3 小时前
不再有分配延迟:在无状态 Elasticsearch 中将快照与分片迁移解耦
大数据·运维·人工智能·elasticsearch·搜索引擎·全文检索
hacker_LeeFei3 小时前
Flyway使用手册
运维
CS_Zero3 小时前
Ubuntu 22.04挂载新硬盘
linux·运维·ubuntu