配置多公钥在多平台使用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
相关推荐
不吃鱼的羊11 小时前
git推送提示错误missing Change-Id in message footer
git
小霍同学16 小时前
Git 常用指令汇总
git
无限进步_16 小时前
深入解析list:一个完整的C++双向链表实现
开发语言·c++·git·链表·github·list·visual studio
Awna17 小时前
Git 合并多次提交记录实战
git
火车叼位18 小时前
一次看懂 Git 仓库分叉、冲突已解决但仍在合并中的状态
git
ruanCat20 小时前
simple-git-hooks 踩坑实录:钩子装对了却从没触发过,原来是 .git 目录捣的鬼
前端·git·代码规范
葱卤山猪1 天前
Git常用核心命令实操总结(新手避坑版)
大数据·git·elasticsearch
深蓝轨迹1 天前
Git误操作急救手册
chrome·git·elasticsearch
无限进步_1 天前
【C++】字符串中的字母反转算法详解
开发语言·c++·ide·git·算法·github·visual studio
Tipriest_1 天前
git reflog介绍(找回之前detach后做的commit)
git