配置多公钥在多平台使用Git

步骤很详细,直接上教程

当我们想在不同远程仓库平台配置不同公钥时会发现不进行额外配置是不行的,只会使用默认的公钥,本篇文章便是为了解决这个问题

  1. 进入C:\Users\[你的用户名]\.ssh文件夹
    如果没有这个文件夹可以新建一下
  1. 在上述文件夹新建文件config
  1. 在该文件中填入以下模板内容

    此处举例了几个,不同平台需修改域以及我们设定的公钥文件名,文件名按自己的自行修改,建议使用眨眼睛的命名格式,

    生成公钥的命令行ssh-keygen -t rsa

bash 复制代码
# github
Host github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/github_id_rsa

# gitee
Host gitee.com
HostName gitee.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/gitee_id_rsa

# codeup
Host codeup.aliyun.com
HostName codeup.aliyun.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/codeup_id_rsa
相关推荐
阿寻寻7 小时前
【云原生技术】git checkout -- . 应该用在切分之前还是之后?
git
周杰伦fans8 小时前
Git 推送实战:冲突解决与强制推送
git
Beyond欣15 小时前
Git 踩坑记录
git
没有bug.的程序员16 小时前
分布式配置深潜:Spring Cloud Config 与 Git 集成内核、版本回滚机制与多环境治理实战指南
java·分布式·git·spring cloud·分布式配置·版本回滚
JTfAbUGXr19 小时前
Smart200PL与42块安科瑞多功能电度表Modbus RTU通讯程序探索
git
Beyond欣19 小时前
Git 配置与工具
大数据·git·elasticsearch
xuhe21 天前
Claude Code配合Astro + GitHub Pages:为 sharelatex-ce 打造现代化的开源项目宣传页
linux·git·docker·github·浏览器·overleaf
西门吹-禅1 天前
git 使用
git
前路不黑暗@2 天前
Java项目:Java脚手架项目的模板服务和网关服务的实现(三)
java·开发语言·spring boot·git·学习·spring cloud·maven
贡献者手册2 天前
当 AI 写代码的速度超过了你提交的速度:为何你需要一款“流式” Git 管理器?
人工智能·git