markdown 如何为两个GitLab帐户设置两个SSH密钥

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 如何为两个GitLab帐户设置两个SSH密钥相关的知识,希望对你有一定的参考价值。

Simply declare each private ssh keys in a %HOME%/.ssh/config file:

```
Host gitlabuser1
    User git
    Hostname {hostname}
    PreferredAuthentications publickey
    IdentityFile C:/Users/{username}/.ssh/id_rsa1

Host gitlabuser2
    User git
    Hostname {hostname}
    PreferredAuthentications publickey
    IdentityFile C:/Users/{username}/.ssh/id_rsa2
```    
    
That supposes your set of ssh keys are:
```
%HOME%/.ssh/id_rsa1 ; %HOME%/.ssh/id_rsa1.pub
%HOME%/.ssh/id_rsa2 ; %HOME%/.ssh/id_rsa2.pub
```

You can then use the urls for clone/push/pull:
```
gitlabuser1:yourRepo1
gitlabuser2:yourRepo2
```

via https://stackoverflow.com/questions/30320458/how-to-set-up-two-ssh-keys-for-two-gitlab-accounts-and-push-pull-by-using-tortoi

以上是关于markdown 如何为两个GitLab帐户设置两个SSH密钥的主要内容,如果未能解决你的问题,请参考以下文章

如何为同一主机的多个 gitlab 帐户使用多个 ssh 密钥[重复]

如何为两个不同的帐户使用cmd命令[重复]

如何为 API 凭据设置/取消设置多个帐户

如何为 gitlab 集成 sourcetree

如何为私有 GKE 集群启用 Gitlab CI/CD?

如何为wordpress项目同步两个数据库?