配置多公钥在多平台使用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
相关推荐
原来是猿15 小时前
Git入门指南(一):从零开始,掌握Git基础操作
git
逆风飞翔i16 小时前
使用Cherry-pick合并指定分支指定提交记录
git
秦时明月之君临天下17 小时前
Git统计各分支大小
git
spencer_tseng17 小时前
tortoisegitplink: unknown option “-o“
git·tortoisegit
小陈工17 小时前
Python开源代码管理避坑实战:从Git高级操作到Docker环境配置
开发语言·git·python·安全·docker·开源·源代码管理
春日见1 天前
E2E自驾规控30讲:导论
开发语言·驱动开发·git·matlab·计算机外设
__雨夜星辰__1 天前
什么是 Git 与 Git※hub(※Git※hub加※速访※问教程)
git·github
家里有只小肥猫1 天前
新项目git推送 删除
git
小码狐2 天前
GIT相关
git·idea·基础
csdn_aspnet2 天前
Git贡献全流程拆解:从Fork到PR的完整指南
git·fork·pr