【问题标题】:Multiple ssh keys for multiple accounts on bitbucket/github, not workingbitbucket / github上多个帐户的多个ssh密钥,不起作用
【发布时间】:2014-09-11 05:07:15
【问题描述】:

尽管关于这个主题有很多问题,但我在尝试完成这项工作时遇到了麻烦。要么我错过了什么,要么他们不是我想要的。

我在 github 上有两个帐户 - account1account2 及其各自的存储库

git@bitbucket.org:account1/repo.git
git@bitbucket.org:account2/repo.git

在我的 PC 上,我为 account1_id_rsaaccount1_id_rsa 分别创建了 2 个单独的 SSH 密钥

当我将它们命名为 id_rsa 时,它们都单独工作,默认情况下它们都可以工作。但是我希望能够保留它们名为 account1_id_rsaaccount1_id_rsa 的键,并且仍然能够推/拉,而无需根据我目前想要处理的存储库重命名每个键。

在阅读了许多关于该主题的 QA 之后,我仍然不知道该在我的 .ssh\config 中添加什么。到目前为止我已经尝试过

Host           bitbucket
HostName       bitbucket.org
IdentityFile   ~/.ssh/account2_id_rsa
User           account2
Host           bitbucket
HostName       bitbucket.org
IdentityFile   ~/.ssh/account1_id_rsa
User           account1

【问题讨论】:

    标签: git ssh


    【解决方案1】:

    在这里找到答案

    http://kevinpelgrims.com/blog/2012/07/19/setting-up-multiple-github-accounts-on-windows

    Host           account1.bitbucket
    HostName       bitbucket.org
    IdentityFile   ~/.ssh/account1_id_rsa
    
    Host           account2.bitbucket
    HostName       bitbucket.org
    IdentityFile   ~/.ssh/account2_id_rsa
    

    最重要的是,我需要有以下 git URL

    git@account1.bitbucket.org:repo.git
    git@account2.bitbucket.org:repo.git
    
    猜你喜欢
    • 2020-02-18
    • 2018-03-17
    • 1970-01-01
    • 1970-01-01
    • 2015-11-19
    • 2017-07-02
    • 1970-01-01
    • 2012-12-29
    • 1970-01-01
    相关资源
    最近更新 更多