无法使用不同的ssh密钥访问Git服务

时间:2018-01-27 07:19:55

标签: git ssh

我使用三个ssh密钥来访问GitHub,GitLab和BitBucket。但我不知道为什么我只能访问GitLab。我用ssh -T来测试。 GitHub和Bitbucket都显示了这个git@github.com: Permission denied (publickey)。我确信我已经为这些服务添加了密钥。

这是我的.ssh文件夹中的配置。 请帮帮我。

# --- Sourcetree Generated ---
Host Rukeith-GitHub
    HostName github.com
    User Rukeith
    PreferredAuthentications publickey
    IdentityFile /Users/rukeith/.ssh/Rukeith-GitHub
    UseKeychain yes
    AddKeysToAgent yes
# ----------------------------

# --- Sourcetree Generated ---
Host Rukeith-Bitbucket
    HostName bitbucket.org
    User Rukeith
    PreferredAuthentications publickey
    IdentityFile /Users/rukeith/.ssh/Rukeith-Bitbucket
    UseKeychain yes
    AddKeysToAgent yes
# ----------------------------

# GitLab.com server
Host gitlab.com
    HostName gitlab.com
    User Rukeith
    PreferredAuthentications publickey
    IdentityFile /Users/rukeith/.ssh/Rukeith-Gitlab
    UseKeychain yes
    AddKeysToAgent yes

# Private GitLab server
Host gitlab.company.com
    HostName gitlab.company.com
    User Rukeith
    PreferredAuthentications publickey
    IdentityFile /Users/rukeith/.ssh/Rukeith-Gitlab
    UseKeychain yes
    AddKeysToAgent yes

1 个答案:

答案 0 :(得分:0)

我发现解决方案是自己使用ssh-add -K key。 一点点问题。

相关问题