配置多公钥在多平台使用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
相关推荐
春日见2 小时前
GIT操作大全(个人开发与公司开发)
开发语言·驱动开发·git·matlab·docker·计算机外设·个人开发
Ama_tor3 小时前
将本地的 Electron 项目上传到 Gitee(码云)的 Git 操作流程
git·electron·gitee
笑鸿的学习笔记4 小时前
git笔记之--abort和--quit参数详解
笔记·git
Z.风止4 小时前
Large Model-learning(1)
开发语言·笔记·git·python·学习
Be for thing4 小时前
分支管理与冲突解决
git·学习
极地星光5 小时前
从零到一搭建 **多仓库项目(Repo Manager 架构)** 完整步骤
git·架构
原来是猿5 小时前
进程间通信(三):命名管道
linux·服务器·网络·git
幸福从心动开始5 小时前
脱单不是拖,爱要主动说——写给还在“git commit -m ‘等缘分’”的程序员
git
弹简特8 小时前
【测试基础】11-软件测试之测试方案编写&测试报告编写&Git工具安装
git·功能测试
吴声子夜歌21 小时前
TypeScript——泛型
前端·git·typescript