7

After creating my rails project, pushing it into the GIT repo, was not able to push it to Heroku. When I run the command:

git push heroku master

I get this error:

ssh: connect to host heroku.com port 22: Bad file number
fatal: The remote end hung up unexpectedly

Am not behind a firewall, proxy or vpn.. I have run

  heroku status

and it is working fine.

I have even made sure ssh is working fine with Git. and run

 ssh -vT git@github.com

and it run successfully

I run

 telnet heroku.com 22 

and it failed

 connecting to heroku.com .. could not open connection to the host, on port 22:Connect failed

Also run and failed

 ssh git@heroku.com
 ssh: connect to host heroku.com port 22: bad file number
vonbrand
  • 11,412
  • 8
  • 32
  • 52
Postscripter
  • 521
  • 7
  • 18
  • 1
    Did you check if SSH is working fine with *Heroku* too? – poke Jan 02 '13 at 22:46
  • Related: http://stackoverflow.com/questions/7144811/git-ssh-error-connect-to-host-bad-file-number, http://stackoverflow.com/questions/9274465/ssh-connect-to-host-heroku-com-port-22-bad-file-number – poke Jan 02 '13 at 22:50
  • @poke I have previously found the related questions, but they dont solve my issue. Regarding SSHing Heroku. What command I should use exactly? – Postscripter Jan 04 '13 at 09:52
  • @poke , ok I have run ssh git@heroku.com and if failed ssh: connect to host heroku.com port 22: bad file number – Postscripter Jan 04 '13 at 10:25
  • Also run telnet heroku.com 22 and it failed connecting to heroku.com .. could not open connection to the host, on port 22: connect failed – Postscripter Jan 04 '13 at 10:26
  • Can you try setting up your heroku remote using the heroku command line tool? I.e. `heroku git:remote -a ` – poke Jan 04 '13 at 12:00
  • yes I was able to run that, and it says:! Git remote heroku already exists actually I have already used the command "heroku create" this is why it says already exist..right? – Postscripter Jan 04 '13 at 15:24
  • Hmm, then I’m out of ideas. You might want to contact Heroku support. – poke Jan 04 '13 at 15:43
  • 1
    Maybe this could help: http://stackoverflow.com/questions/10555546/error-in-git-push-heroku-master-through-ssh-behind-proxy – Vinicius Spader Mar 01 '13 at 19:15
  • What about adding the verbose flag to see details? – nTraum Jul 17 '13 at 14:38

1 Answers1

1

The dreaded Bad file number. It's the PC LOAD LETTER of git. It's inscrutable, but almost always a bad key. Try updating your key in heroku and make sure that you are presenting the correct key when trying to connect.

Howie Ross
  • 76
  • 8