配置Git多账号使用ssh

  1. 第一步:生成ssh公私钥
ssh-keygen -t rsa -C “邮箱”
  1. 第二步:创建配置文件
# 配置github.com
Host github.com                 
    HostName github.com
    IdentityFile C:\Users\chao\.ssh\id_rsa_github
    PreferredAuthentications publickey
    User 1326330617@qq.com

# 配置gitee.com
Host gitee.com
    HostName gitee.com
    IdentityFile C:\Users\chao\.ssh\id_rsa_gitee
    PreferredAuthentications publickey
    User 1326330617@qq.com
    
# 配置gitlab
Host *.*.*.*
    HostName *.*.*.*
    IdentityFile C:\Users\chao\.ssh\id_rsa_gitlab
    PreferredAuthentications publickey
    User yanglichao
  1. 第三步:将公钥放置到版本仓库
不会去百度

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理