在本机上同时使用GitHub与GitLab

在本机上同时使用GitHub与GitLab

  • 进入.ssh文件夹

    1
    cd .ssh/
  • 修改config文件(若没有,touch config)

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    # gitlab
    Host gitlab.com
    HostName gitlab.com
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/id_rsa
    # github
    Host github.com
    HostName github.com
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/id_rsa_github
  • 测试连接

    1
    ssh -T [email protected]

若输出如下,则连接成功

1
Hi BreadKid! You've successfully authenticated, but GitHub does not provide shell access.

参考博客

Joyce Lau wechat
扫一扫上面的微信订阅号,和我家萌客服聊聊天哟!
谢谢打赏