【发布时间】:2018-03-17 09:15:10
【问题描述】:
我有一个与我的 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.
【问题讨论】:
-
提及您使用的操作系统可能会有所帮助
-
git 知道使用哪个键吗?如果您没有在任何地方指定它,它将默认为标准
id_rsa。我会将github.com添加到.ssh/config文件并在那里指定密钥。 -
我已经修改了我上面的问题。我仍然有问题。我需要为项目添加单独的 ssh 密钥吗?
标签: github ssh public-key