Heroku 'Permission denied (publickey) fatal: Could not read from remote repository' woes

前端 未结 14 1735
故里飘歌
故里飘歌 2020-12-12 08:57

I\'ve searched around for many hours on end looking to a solution to my seemingly easy-to-fix problem. It\'s not that my search turned up nothing, it\'s that my search turne

14条回答
  •  感动是毒
    2020-12-12 09:26

    Had a similar issue, and tried lots of things. Ultimately what worked for me, was to have Gnu on Windows installed (https://github.com/bmatzelle/gow/releases) , and ensure that it was using the ssh tool inside that directory and not the one with Git. Once installed test with (ensure if its in your environment PATH that it preceds Git\bin)

    C:\Git\htest2>which ssh
    C:\Program Files (x86)\Gow\bin\ssh.BAT
    

    I used putty and pageant as described here:http://rubyonrailswin.wordpress.com/2010/03/08/getting-git-to-work-on-heroku-on-windows-using-putty-plink-pageant/

    Once the keys had been sent to heroku (heroku keys:add c:\Users\Person.ssh\id_rsa.pub), use

    ssh -v @heroku.com 
    

    and ensure that your stack is showing use of Putty - ie a working stack:

    Looking up host "heroku.com"
    Connecting to 50.19.85.132 port 22
    Server version: SSH-2.0-Twisted
    Using SSH protocol version 2
    **We claim version: SSH-2.0-PuTTY_Release_0.62**
    Using Diffie-Hellman with standard group "group1"
    Doing Diffie-Hellman key exchange with hash SHA-1
    Host key fingerprint is:
    ssh-rsa 2048 8b:48:5e:67:0e:c9:16:47:32:f2:87:0c:1f:c8:60:ad
    Initialised AES-256 SDCTR client->server encryption
    Initialised HMAC-SHA1 client->server MAC algorithm
    Initialised AES-256 SDCTR server->client encryption
    Initialised HMAC-SHA1 server->client MAC algorithm
    Pageant is running. Requesting keys.
    Pageant has 1 SSH-2 keys
    Using username "*--ommitted for security--*".
    **Trying Pageant key #0**
    Authenticating with public key "rsa-key-20140401" from agent
    Sending Pageant's response
    Access granted
    Opened channel for session
    Server refused to allocate pty
    Server refused to start a shell/command
    FATAL ERROR: Server refused to start a shell/command
    

    One that was running previously and failed:

    C:\Git\htest2>ssh -v @gmail.com@heroku.com
    OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
    debug1: Connecting to heroku.com [50.19.85.156] port 22.
    debug1: Connection established.
    debug1: identity file /c/Users/Person/.ssh/identity type -1
    debug1: identity file /c/Users/Person/.ssh/id_rsa type 1
    debug1: identity file /c/Users/Person/.ssh/id_dsa type -1
    debug1: Remote protocol version 2.0, remote software version Twisted
    debug1: no match: Twisted
    debug1: Enabling compatibility mode for protocol 2.0
    **debug1: Local version string SSH-2.0-OpenSSH_4.6**
    debug1: SSH2_MSG_KEXINIT sent
    debug1: SSH2_MSG_KEXINIT received
    debug1: kex: server->client aes128-cbc hmac-md5 none
    debug1: kex: client->server aes128-cbc hmac-md5 none
    debug1: sending SSH2_MSG_KEXDH_INIT
    debug1: expecting SSH2_MSG_KEXDH_REPLY
    debug1: Host 'heroku.com' is known and matches the RSA host key.
    debug1: Found key in /c/Users/Person/.ssh/known_hosts:1
    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: /c/Users/Person/.ssh/identity
    debug1: Offering public key: /c/Users/Person/.ssh/id_rsa
    debug1: Server accepts key: pkalg ssh-rsa blen 277
    debug1: Trying private key: /c/Users/Person/.ssh/id_dsa
    debug1: No more authentication methods to try.
    Permission denied (publickey).
    

提交回复
热议问题