配置多公钥在多平台使用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
相关推荐
Leo⁵6 小时前
基于 Git 的 Obsidian 笔记同步
笔记·git
Qres8219 小时前
Git基础命令学习笔记
笔记·git·学习
REDcker10 小时前
Git分支与版本管理实践
git
Goodbye14 小时前
Git 开发必备性能
git
Wils0nEdwards15 小时前
Windows本地 git 版本管理
windows·git·elasticsearch
Niliuershangba15 小时前
ChestnutCMS 栗子内容管理系统:从入门到模板开发实战
java·git·开源·gitlab·github·开源软件·gitcode
专注VB编程开发20年16 小时前
安桌15系统文件直接存到其他目录要权限吗?/storage/emulated/0/Downloa
git
解道Jdon18 小时前
从Go转向Rust迁移指南:靠自觉 vs. 靠编译器
ide·windows·git·svn·eclipse·github·visual studio
霸道流氓气质20 小时前
Git 三方合并策略详解
git
Cry丶20 小时前
GitHub 开源项目 PR 提交流程:从 Fork 到 CLA 签署
git·github·开源贡献·pull request·cla