配置多公钥在多平台使用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
相关推荐
淡淡的id1 小时前
git的功能分支的base分支错了怎么重新提交
git
Ever_Zhang4 小时前
Git 大文件使用 Git-LFS 管理,推送失败
git·git lfs·gitattributes·git 推送大文件
-曾牛5 小时前
Git Flow
大数据·git·学习·elasticsearch·个人开发
Zfox_5 小时前
Git 进阶之路:高效协作之分支管理
大数据·linux·运维·c++·git·elasticsearch
小生不才yz6 小时前
23. git reset
git
码农小站7 小时前
开发手记 | IDEA代码Push后回退
git
兔六哥7 小时前
当更改新的 git 仓库地址时,不要着急执行 clone 应该先运行这个
git
weixin-a1530030831613 小时前
git常用命令
git
前端小干将14 小时前
开发过程中,git常用命令
git
西柚啊15 小时前
Git常用命令总结
前端·git