2017-10-05 300 views
0

我有一個id_keynamex與我的github帳戶關聯,該帳戶從我的本地~/.ssh/添加到https://github.com/settings/keys。此密鑰沒有密碼,並且與我的帳戶整體綁定。github帳戶SSH密鑰無法使用

我已經跟蹤我的項目在我的帳戶資料庫:origin [email protected]: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. 
+0

它可能有助於提及您正在使用的操作系統 – rob

+0

git是否知道使用哪個密鑰?如果你沒有在任何地方指定它,它將默認爲標準的'id_rsa'。我會將'github.com'添加到'.ssh/config'文件並在那裏指定密鑰。 – Holloway

+0

我修改了上面的問題。我仍然有問題。我需要爲項目添加一個單獨的ssh密鑰嗎? – HGB

回答

0

我刪除了以下從我的配置文件:

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

爲了讓我只有這個主機的一個實例,現在它似乎工作。