配置多公钥在多平台使用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
相关推荐
petunsecn14 小时前
多 GitHub 账号与多平台 Git 使用(附加场景:就想用指定账号clone)
git·github
yuanmenghao15 小时前
Git submodule 与 git-repo(Google 的 repo 工具) 在多仓库管理上的差异
git
木易双人青15 小时前
git常用命令
git
热忱112815 小时前
Git 全套常用命令手册(含日常开发示例)
大数据·git·elasticsearch·搜索引擎
Aliex_git15 小时前
Git SSH 配置
笔记·git·学习·ssh
小舞O_o16 小时前
gitlab文件上传
linux·服务器·git·python·目标检测·机器学习·gitlab
C++ 老炮儿的技术栈1 天前
在C++ 程序中调用被 C编译器编译后的函数,为什么要加 extern “C”声明?
c语言·c++·windows·git·vscode·visual studio
Robin罗兵1 天前
git使用教程2
git
bob_young1 天前
Git LFS + Gerrit 配置+lfs-test-server(git lfs push总是提示输入https密码解决)
git·lfs
半夏微凉半夏殇1 天前
git add . 是否会包含.o、.so、.ko文件?深度解析与避坑指南
git