配置多公钥在多平台使用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
相关推荐
Zucker n9 小时前
配置 GitHub SSH 密钥认证(自用笔记)
git
GoodStudyAndDayDayUp16 小时前
GXW-Git规范
git
weixin_307779131 天前
Git中获取一个目录下所有文件的最后修改人的邮箱
开发语言·git·算法
ynchyong2 天前
Git 急救指南:手滑 add / commit 错了,怎么优雅地撤回
git·手滑
Zucker n2 天前
Git 常用命令速查(自用笔记)
git
雪碧聊技术3 天前
Git实战:在Idea中,如何只将分支 A 某次 Commit记录的单个文件同步到分支 B?一文详解|保姆教程
git·文件对比,一键应用
Mortalbreeze3 天前
Git 基础篇(三):分支管理
git
Zucker n3 天前
安装 Git for Windows(自用笔记)
笔记·git
棒子胡豆3 天前
Git总结
git
`流年づ5 天前
联邦学习-安全聚合
git·安全·github