分别使用多账号生成不同平台认证密钥

这里生成了

id_rsa 对应阿里code
xxxx@126 对应gitee
yyyy@126 对应github
生成秘钥对并指定秘钥对名称:
ssh-keygen -t rsa
ssh-keygen -t rsa -f other -C "xxxx@126.com"
ssh-keygen -t rsa -f other -C "yyyy@126.com"

  

进入.ssh目录

cd ~/.ssh/

  

创建config文件

vi config

  

写入多密钥和使用平台

# 阿里code
Host code.aliyun.com
HostName code.aliyun.com
User git
IdentityFile /Users/admin/.ssh/id_rsa

# 码云
# xxxx@126 (xxxx@126.com)
Host gitee.com
HostName gitee.com
User git
IdentityFile /Users/admin/.ssh/xxxx@126

# github
# yyyy@126 (yyyy@126.com)
Host github.com
HostName github.com
User git
IdentityFile /Users/admin/.ssh/yyyy@126

  

保存退出即可

 

相关文章:

  • 2022-12-23
  • 2021-09-13
  • 2022-12-23
  • 2021-12-17
  • 2021-04-06
  • 2022-12-23
  • 2021-06-05
猜你喜欢
  • 2021-04-19
  • 2021-11-06
  • 2021-11-23
  • 2022-03-09
  • 2021-11-23
  • 2021-06-30
相关资源
相似解决方案