Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ssh: connect to host heroku.com port 22: Connection timed out

I am working on Ubuntu 11.10 Local branch of my git-repo is up to date

I then wrote following command in terminal: heroku create --stack cedar and it said:
Notice: on Wed, 20 June, our default stack will change to Cedar. http://bit.ly/Lh0rM5

Creating radiant-wind-7413... done, stack is cedar
http://radiant-wind-7413.herokuapp.com/ | [email protected]:radiant-wind-7413.git
Git remote heroku added

All fine till now, then I typed following in terminal:

git push heroku master

and the following error occured: ssh: connect to host heroku.com port 22: Connection timed out
fatal: The remote end hung up unexpectedly

like image 239
user1447288 Avatar asked Jun 10 '12 12:06

user1447288


4 Answers

As of November 30, 2021, the SSH Git Transport feature has been deprecated by Heroku and only HTTP transport is supported. The real shutdown of SSH was in March 2022.

You have to reconfigure the repo with :

heroku git:remote -a <app-name>

Official statement from Heroku

If you are using a remote with a different name, e.g. production then use

heroku git:remote -a <app-name> -r <remote-name>

Maybe you will have to unset ssh connections on git global config :

git config --global --unset url.ssh://git@heroku/.insteadof
git config --global --unset url.ssh://[email protected]/.insteadof
like image 192
novastra Avatar answered Oct 23 '22 13:10

novastra


Most probably some sort of firewall issue or your network admin has blocked outgoing port 22 in your network.

You may use simple scrip to see your connection to Heroku by :

$ ssh -vvv [email protected]

If you seeing connect timed out then you may need to request your admin to unblock port 22. Alternatively may access Heroku via tunneling as per my answer in Connecting to heroku using port 443

like image 25
AzizSM Avatar answered Oct 23 '22 13:10

AzizSM


I had the similar problem with keys. Ok this is what I did.

Check the status of your keys with

heroku keys

It shows you list of keys that are added to heroku. You can always generate new keys and add them to heroku.

ssh-keygen -t rsa

Generates new key.

heroku keys:add

adds the keys to heroku. Before adding it lists the available keys that you can add. Enter the option and you key is added to heroku.

This article can be helpful. If that doesn't work then there should be some problem with ssh. Try doing an ssh localhost and see if ssh is working.

like image 5
Maddy Avatar answered Oct 23 '22 15:10

Maddy


Today Heroku uses git over ssh. The default port for ssh is 22 and it looks like your network doesn't allow outbound connections to port 22. Perhaps this is something your network administrator can change.

like image 2
James Ward Avatar answered Oct 23 '22 15:10

James Ward