配置多公钥在多平台使用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
相关推荐
阿崽meitoufa1 小时前
hermes-agent安装到本地 Git方法
git·hermes·hermes-agent
云攀登者-望正茂4 小时前
特性分支合并develop引发的污染问题
git
就叫年华吧丶6 小时前
Git Bash、CMD 与 PowerShell 的区别详解
linux·git·命令行·powershell·cmd·gitbash
白玉cfc7 小时前
Git提交规范
git·github
电化学仪器白超19 小时前
小乌龟Git全程图形化操作指南:嵌入式本地版本管理与Gitee私有云备份实战
git·python·单片机·嵌入式硬件·物联网·gitee·自动化
K3v1 天前
【git】删除本地以及远端已经合并到master的分支
大数据·git·elasticsearch
云攀登者-望正茂1 天前
将 develop 分支拉取到特性分支时解决合并污染问题
git
金銀銅鐵1 天前
[git] 如何找到已经“丢失”的 commit?
git·后端
尘世壹俗人1 天前
linux编译安装git
linux·运维·git
打不了嗝 ᥬ᭄2 天前
Git 原理与使用
git·gitee