Windows GitBash解决Github添加密钥时提示Key is already in use的问题

通过添加多密钥实现

  • ssh-agent bash
  • ssh-keygen -t rsa -C 'xx1' -f ~/.ssh/id_rsa_xx1
  • ssh-keygen -t rsa -C 'xx2' -f ~/.ssh/id_rsa_xx2
  • ssh-add id_rsa_xx1
  • ssh-add id_rsa_xx2

vim ~/.ssh/config

shell 复制代码
Host github_xx1
 HostName github.com
 User git
 IdentityFile ~/.ssh/id_rsa_xx1
Host github_xx2
 HostName github.com
 User git
 IdentityFile ~/.ssh/id_rsa_xx2
  • ssh -T -ai ~/.ssh/id_rsa_xx1 git@github_xx1
  • ssh -T -ai ~/.ssh/id_rsa_xx2 git@github_xx2
相关推荐
神一样的老师21 分钟前
【兆易创新GD32VW553开发板试用】 BSP 从 GitHub 下载与编译指南
单片机·github·rt-thread
DevilSeagull1 小时前
MySQL(1) 安装与配置
java·数据库·git·mysql·http·开源·github
kefon2 小时前
从零搭一个 AI Agent:我选了最省钱的方案
开源·github·agent
FreeBuf_3 小时前
GitHub评论可触发Claude Code、Gemini CLI和GitHub Copilot的提示注入漏洞
github·copilot
fzil0013 小时前
GitHub 项目自动 Star + Issue 监控
人工智能·github·issue
Daydream.V3 小时前
github基础入门及git安装配置
git·github·git学习·github学习
万琛3 小时前
【 GitHub GraphQL 】查询优化
github·graphql
Java_2017_csdn4 小时前
‌IntelliJ IDEA 2026.1 中 Git、GitHub、GitLab 功能对比与实操指南
git·github·intellij-idea
本地化文档4 小时前
rustup-book-l10n
rust·github·gitcode
wohehe18 小时前
Android项目工程化-Github Actions
linux·github