10
git push heroku master

returns:

ssh_exchange_identification: read: Connection reset by peer      
fatal: The remote end hung up unexpectedly.

This is the first time I've tried to push to heroku.

  • heroku login returns "Authentication successful"
  • ~/.ssh/id_rsa was originally created by the heroku command line client - I ran heroku login for the first time and it asked if I wanted to generate a key.
  • I recreated keys using ssh-keygen -t rsa (as specified here) and then tried again but in vain.
  • Created "authorized_keys" at "~/.ssh" and with my public key in it, no luck.
  • Created /etc/hosts.allow with contents "sshd all", still no luck.

Permissions on the keys are : "-rw-------" Heroku status is O.K. I'm using Mac OS X 10.7.

ssh -vvv myloginname@heroku.com

returns:

OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011   
debug1: Reading configuration data /etc/ssh_config  
debug1: Applying options for *  
debug2: ssh_connect: needpriv 0   
debug1: Connecting to heroku.com [50.19.85.132] port 22.   
debug1: Connection established.   
debug3: Not a RSA1 key file ~/.ssh/id_rsa.   
debug2: key_type_from_name: unknown key type '-----BEGIN'   
debug3: key_read: missing keytype    
debug3: key_read: missing whitespace   
debug3: key_read: missing whitespace   
debug3: key_read: missing whitespace    
debug3: key_read: missing whitespace   
debug3: key_read: missing whitespace   
debug3: key_read: missing whitespace  
debug3: key_read: missing whitespace   
debug3: key_read: missing whitespace   
debug3: key_read: missing whitespace   
debug3: key_read: missing whitespace     
debug3: key_read: missing whitespace    
debug3: key_read: missing whitespace     
debug3: key_read: missing whitespace     
debug3: key_read: missing whitespace      
debug3: key_read: missing whitespace       
debug3: key_read: missing whitespace       
debug3: key_read: missing whitespace        
debug3: key_read: missing whitespace           
debug3: key_read: missing whitespace            
debug3: key_read: missing whitespace              
debug3: key_read: missing whitespace               
debug3: key_read: missing whitespace               
debug3: key_read: missing whitespace             
debug3: key_read: missing whitespace           
debug3: key_read: missing whitespace             
debug2: key_type_from_name: unknown key type '-----END'             
debug3: key_read: missing keytype               
debug1: identity file ~/.ssh/id_rsa type 1             
debug1: identity file ~/.ssh/id_rsa-cert type -1            
debug1: identity file ~/.ssh/id_dsa type -1            
debug1: identity file ~/.ssh/id_dsa-cert type -1               
ssh_exchange_identification: read: Connection reset by peer            
culix
  • 10,188
  • 6
  • 36
  • 52
rishabhjain
  • 131
  • 1
  • 3
  • 7

2 Answers2

3

I had the very same problem (not on heroku) but on my own server.

Try to look in /var/log/auth.log my ~/.ssh/authorized_keys file was ownd by the wrong user

yellowsir
  • 741
  • 1
  • 9
  • 27
-1

If I try

ssh -vvv myloginname@heroku.com

I get this:

debug2: key_type_from_name: unknown key type '-----END'
...
debug3: check_host_in_hostfile: filename ~/.ssh/known_hosts
debug3: check_host_in_hostfile: match line 1
debug3: check_host_in_hostfile: filename ~/.ssh/known_hosts
debug3: check_host_in_hostfile: match line 2
debug1: Host 'heroku.com' is known and matches the RSA host key.
debug1: Found key in ~/.ssh/known_hosts:1
debug2: bits set: 500/1024
debug1: ssh_rsa_verify: signature correct

Do you have a known_hosts file in ~/.ssh/? Mine contains entries for heroku.com,50.19.85.154 ssh-rsa and 50.19.85.132 ssh-rsa. Do you have those?

If you do which ssh-keygen, what version of ssh-keygen is being run? Is it the proper copy that should be getting used/that was installed by the Heroku Toolbelt? If not, perhaps the steps from the Heroku Managing Keys article are not creating a valid key?

culix
  • 10,188
  • 6
  • 36
  • 52