配置多公钥在多平台使用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
相关推荐
2401_876964135 小时前
27考研余炳森概率论|喻老李良2027资料网课
windows·git·考研·svn·eclipse·github·概率论
爱搬砖的狮子6 小时前
【Git】git repo下载使用
git
cheems95279 小时前
Git基本操作
git
Irissgwe9 小时前
三、Git 文件状态管理:add、commit、status 和 diff
git
Ws_14 小时前
Git + Gerrit 第三课:分支、切换与合并
git·elasticsearch
xlq2232214 小时前
6.git
git
Drache_long15 小时前
Git命令概述
git
console.log('npc')15 小时前
修改git中commit内容
git
love8888_cnsd15 小时前
Git & Linux 速查表
java·linux·git·后端·elasticsearch
恋喵大鲤鱼1 天前
git checkout
git·git checkout