2011-09-16 44 views
3

Heroku如何授予許可被拒絕的錯誤?

$ git clone -v [email protected]:testabcde.git Cloning into testabcde... 

的Heroku返回

Permission denied (publickey). 
fatal: The remote end hung up unexpectedly 

$ heroku keys 

回報

=== 1 key for [email protected] 
ssh-rsa AAAAB3NzaC...lXLyj9YQ== [email protected] 

現在

$ ssh -v [email protected] -T 

OpenSSH_5.2p1, OpenSSL 0.9.8r 8 Feb 2011 
debug1: Reading configuration data /etc/ssh_config 
debug1: Connecting to heroku.com [50.19.85.154] port 22. 
debug1: Connection established. 
debug1: identity file /Users/ohho/.ssh/identity type -1 
debug1: identity file /Users/ohho/.ssh/id_rsa type 1 
debug1: identity file /Users/ohho/.ssh/id_dsa type 2 
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-5pgsql1 
debug1: match: OpenSSH_5.1p1 Debian-5pgsql1 pat OpenSSH* 
debug1: Enabling compatibility mode for protocol 2.0 
debug1: Local version string SSH-2.0-OpenSSH_5.2 
debug1: SSH2_MSG_KEXINIT sent 
debug1: SSH2_MSG_KEXINIT received 
debug1: kex: server->client aes128-ctr hmac-md5 none 
debug1: kex: client->server aes128-ctr hmac-md5 none 
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent 
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP 
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent 
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY 
debug1: Host 'heroku.com' is known and matches the RSA host key. 
debug1: Found key in /Users/ohho/.ssh/known_hosts:5 
debug1: ssh_rsa_verify: signature correct 
debug1: SSH2_MSG_NEWKEYS sent 
debug1: expecting SSH2_MSG_NEWKEYS 
debug1: SSH2_MSG_NEWKEYS received 
debug1: SSH2_MSG_SERVICE_REQUEST sent 
debug1: SSH2_MSG_SERVICE_ACCEPT received 
debug1: Authentications that can continue: publickey 
debug1: Next authentication method: publickey 
debug1: Trying private key: /Users/ohho/.ssh/identity 
debug1: Offering public key: /Users/ohho/.ssh/id_rsa 
debug1: Remote: Forced command: /home/git/bin/git_proxy [email protected] 
debug1: Remote: Port forwarding disabled. 
debug1: Remote: X11 forwarding disabled. 
debug1: Remote: Agent forwarding disabled. 
debug1: Remote: Pty allocation disabled. 
debug1: Server accepts key: pkalg ssh-rsa blen 277 
debug1: PEM_read_PrivateKey failed 
debug1: read PEM private key done: type <unknown> 
debug1: PEM_read_PrivateKey failed 
debug1: read PEM private key done: type <unknown> 
debug1: PEM_read_PrivateKey failed 
debug1: read PEM private key done: type <unknown> 
debug1: PEM_read_PrivateKey failed 
debug1: read PEM private key done: type <unknown> 
debug1: PEM_read_PrivateKey failed 
debug1: read PEM private key done: type <unknown> 
debug1: PEM_read_PrivateKey failed 
debug1: read PEM private key done: type <unknown> 
debug1: PEM_read_PrivateKey failed 
debug1: read PEM private key done: type <unknown> 
debug1: Offering public key: /Users/ohho/.ssh/id_dsa 
debug1: Authentications that can continue: publickey 
debug1: No more authentication methods to try. 
Permission denied (publickey). 

如何修復Permission denied (publickey)錯誤?

UPDATE(文件權限信息):

drwxr-xr-x 11 ohho staff 374 Sep 16 09:37 . 
drwxr-xr-x+ 50 ohho staff 1700 Sep 15 10:34 .. 
-rw------- 1 ohho staff 1743 Sep 16 09:37 github_rsa 
-rw-r--r-- 1 ohho staff 390 Sep 16 09:37 github_rsa.pub 
-rw-r--r-- 1 ohho staff 390 Sep 9 09:47 github_rsa.pub_bak-github 
-rw------- 1 ohho staff 1743 Sep 9 09:47 github_rsa_bak-github 
-rw------- 1 ohho staff 736 Dec 2 2010 id_dsa 
-rw-r--r-- 1 ohho staff 606 Dec 2 2010 id_dsa.pub 
-rw------- 1 ohho staff 1743 Jan 28 2011 id_rsa 
-rw-r--r-- 1 ohho staff 399 Jan 28 2011 id_rsa.pub 
[email protected] 1 ohho staff 10752 Sep 16 11:47 known_hosts 
+0

'chmod 700'''ssh'(現在是'755') – VonC

+0

'chmod 700'給出了相同的錯誤 – ohho

+0

然後你可以嘗試'ss h.exe'解決方法。 – VonC

回答

3

隨着msysgit,檢查您的.ssh目錄的權限從一個bash會話(他們應該是700),以及文件在它(600)。
檢查出issue 261,看看其中一種解決方法是否行得通,比如(如果一切都失敗了),用cygwin替換ssh.exe

ohho提到的SO問題「git clone fails for Heroku project」,其中建議加載Heroku的關鍵(當它具有比默認id_rsa一個不同的名稱)的OP:

ssh-add ~/.ssh/heroku_rsa 

也就是說特別是如果你有一個解決方案已經是id_rsa私鑰(用於其他目的,而不是Heroku的)

+0

更新部分添加了文件權限信息。 – ohho

+0

@ohho:你是否嘗試在配置文件中對每個連接參數進行分組?在http://stackoverflow.com/q/2811387 – VonC

+0

嘗試在'〜/ .ssh'中創建'config',但給出了同樣的錯誤 – ohho

13

我有同樣的問題,能解決這樣做:

ssh-add ~/.ssh/id_rsa 

(公鑰加到heroku的私鑰)

+0

也爲我工作。 OSX Lion 10.7.3 Macbook Air – Ben

+0

womygaad !!你救了我的一天!非常感謝你 – ZX12R

+0

不錯的一個。感謝那。 – nuxibyte

0

我對此有同樣的問題。 我有一個應用程序,然後創建另一個應用程序,同一個帳戶。第一個應用程序仍然適用於git,但在第二個應用程序中無法使用git進行任何操作,甚至其他操作(例如日誌...)仍然有效!

這個工作對我來說: - 清晰的Heroku當前鍵:\ Users \用戶的.ssh:

heroku keys:clear 
  • 的〜/ .ssh/或Windows c刪除當前的私鑰

  • 創建新的密鑰對:

    SSH-凱基-t RSA -C「[email protected]。COM」

  • 上傳到Heroku的:

    Heroku的鍵:添加

它會列出當前的密鑰對你,問你要上傳的一個,輸入數字

完成

相關問題