GIT设置多个ssh的认证秘钥,如github和gitee不同的key

作者:Liaodeity - 2020年11月10日

1、在.ssh目录中

在C盘的C:\Users\jbz\下。jbz为window的登录用户。

添加一个config,文件设置密钥key的地址,Host对于的域名为全域名,无需端口

Host gitlab.com
  Preferredauthentications publickey
  IdentityFile ~/.ssh/gitlab/id_rsa

Host gitee.com
  Preferredauthentications publickey
  IdentityFile ~/.ssh/gitee/id_rsa

2、生成带目录的key

ssh-keygen -o -t rsa -b 4096 -f ~/.ssh/gitee/id_rsa -C "email@example.com"

3、查看公钥

cat ~/.ssh/gitee/id_rsa.pub

4、目录结构图片



本文作者: Liaodeity

本文链接: https://www.jianbaizhan.com/article/700

版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 3.0 许可协议。转载请注明出处!


 请勿发布不友善或者负能量的内容。审查将对发布广告等违规信息进行处罚!