github帐户SSH密钥不起作用

时间:2017-10-05 16:48:07

标签: github ssh public-key

我有一个与我的github帐户关联的id_keynamex,该帐户已从我的本地~/.ssh/添加到https://github.com/settings/keys。此密钥没有密码,并且与我的帐户整体绑定。

我已将我的项目跟踪到我帐户中的存储库:origin git@github.com:MyUser/projectX.git,但每当我尝试提交git push origin master时,我都会被要求为我的ssh文件夹中的另一个键输入密码:

Enter passphrase for key '/Users/myUser/.ssh/id_rsa':

如果我的整个github帐户已经有一个通用密钥,为什么git要求我引用/Users/myUser/.ssh/id_rsa而不是/Users/myUser/.ssh/id_keynamex

编辑:

我已将以下内容添加到.ssh / config文件中:

Host github.com
    User           git
    Hostname github.com
    IdentityFile   ~/.ssh/id_keynamex

Host github.com
  Hostname ssh.github.com
  IdentityFile   ~/.ssh/id_keynamex
  Port 443

但是,我仍然遇到以下问题:

ssh_exchange_identification: Connection closed by remote host
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

1 个答案:

答案 0 :(得分:0)

我从配置文件中删除了以下内容:

Host github.com
  Hostname ssh.github.com
  IdentityFile   ~/.ssh/id_keynamex
  Port 443

所以我只有一个这个主机的实例,现在它似乎可以工作。