配置多公钥在多平台使用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
相关推荐
___波子 Pro Max.1 天前
Git Remote 仓库地址变更
git
ModestCoder_1 天前
Git 忽略所有 `.xlsx`,但保留指定 Excel 文件的方法
git·excel
阡陌..1 天前
202605新版git_2.54.0常用操作指令
大数据·git·elasticsearch
会笑的小熊1 天前
VScode项目推送到git仓库
ide·git·vscode
zhangfeng11331 天前
宝塔服务器完全可以安装 Git,进行版本管理,而且非常简单
运维·服务器·人工智能·git·编程
Bdygsl1 天前
Git(1)—— 基本理解与使用
git
JiaWen技术圈1 天前
增量静态再生(ISR)详解:Next.js 中的实现与应用
javascript·git·ubuntu
The Chosen One9851 天前
【Linux】深入理解Linux进程(二):进程的状态
linux·运维·服务器·开发语言·git
TimberWill1 天前
git worktree实现分支管理
git
普修罗双战士1 天前
项目设计-文章系统发布文章完整前后端设计
java·数据库·vue.js·spring boot·git·intellij-idea