2015-10-13 98 views
0

我正在關注this指南,在我的Mac El Captain上設置ruby on rails環境。ruby​​ on rails git permission denied

我跟隨安裝自制軟件,紅寶石最新版本2.2.3與rbenv。現在,我正在設置git。

隨訪前幾個命令

git config --global color.ui true 
git config --global user.name "YOUR NAME" 
git config --global user.email "[email protected]" 
ssh-keygen -t rsa -C "[email protected]" 

現在,我一直在詢問是否保存生成的密鑰。我將它保存到名爲file~目錄中。我現在有兩個文件,即filefile.pub。我去了this鏈接複製ssh密鑰。我點擊在那裏添加SSH密鑰選項。將密鑰命名爲ROR SSH密鑰

file.pub的關鍵看起來像

SSH-RSS asfjasfhjalsfdhaskfdhalsdfsdf \ ASDF \作爲\ DG \ SA \ fasdfas \˚F\ ASDF ---等隨機數字--- adfasdfasfa [email protected]

我在github上粘貼了密鑰並保存了密鑰。

然後,我回到終端並輸入下面的命令。

ssh -T [email protected] 

,但我沒有收到任何消息,說「excid3嗨!你已經成功驗證,但GitHub上不提供shell訪問。

我得到一個消息,說

The authenticity of host 'github.com (192.30.251.130)' can't be established. 
RSA key fingerprint is SHA256:nThbg6sdfgdfgsdfgGOCspRomTxdCARLviKw6E5SY8. 
Are you sure you want to continue connecting (yes/no)? yes 
Warning: Permanently added 'github.com,192.30.251.130' (RSA) to the list of known hosts. 
Permission denied (publickey). 

上面我在SHA256鍵中改變了幾個字符。只是爲了安全。另外,我也改變了IP地址。但是,它背後的想法是一樣的。

請指導我什麼是錯的。謝謝。

+0

嘗試在終端上鍵入'ssh-add'並再次推送 – matanco

+0

@matanco您能否重新編寫我需要在終端中編寫的完整命令? – AbhimanyuAryan

+0

這是命令:'ssh-add'然後再試一次你做了什麼。 – matanco

回答

2

默認情況下,ssh將在~/.ssh文件夾中查找您的私鑰。由於您將其保存在~中,因此無法找到它。

您可以:

  1. 移動的filefile.pub文件到~/.ssh和重命名爲id_rsaid_rsa.pub,如OS X會自動使用這些文件中的任何ssh命令(如果不進行手動輸入文件名,這是ssh-keygen會保存它們的地方)。
  2. 使用ssh-add -K file命令將密鑰永久添加到OS X鑰匙串。

請注意,GitHub's own instructions表示他們「強烈建議保持默認設置」,而不是將私鑰/公鑰保存在別的地方。

相關問題