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

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/ | git#heroku.com: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

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://git#heroku.com/.insteadof

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 git#heroku.com
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

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.

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.

I had been working on this for hours trying to figure out how I could suddenly have a closed port 22, etc. when literally 5 hours ago everything was working and nothing had changed.
Finally I just reset my Git repo on Heroku and repushed everything. Still no idea what happened.
heroku plugins:install heroku-repo
heroku repo:reset --app appname

Do following steps.
ssh-keygen -t rsa
heroku keys:add
heroku keys # lists keys

For me helped destroying whole app and recreating again - leaving it here for future reference.
heroku apps:destroy appname
heroku apps:create appname
heroku git:remote -a appname
git push heroku master

I added the https url to the .git/config file in my project folder. I found the HTTPS URL in the project Settings on Heroku. I then added that URL to replace the SSH url inside the .git/config text file.

Related

About Heroku config on xplenty-ssh-tunnel application

We are trying to connect MSSQL(directly purchased from Heroku) in Xplenty through an SSH tunnel connection. I would like to ask what should be the SSH host name in heroku config?

Adding ssh-keys in windows for private git

might be a dumb question.... but where do we add the ssh keys of the workstation to the git server both being purely on windows 2012 R2... ..Without the use of github
i had created a remote in the git server repo as
git remote add origin edscs-npe\bzky7x#IP:/c/temp/repo.git
In the workstation i am trying to clone the link as ..
$ git clone edscs-npe\bzky7x#IP:/c/temp/repo.git
Cloning into 'repo'...
ssh: connect to host "IP" port 22: Connection refused
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Now the problem I think here is on the authentication between both the workstation and the git server... where do I add the ssh keys of the workstation to the git server both being windows machine...
Much help would be appreciated
Now the problem i think here is on the authentication between both the workstation and the git server...
To test this, just ssh from the workstation to the server. If it prompts you for a password and you are able to type it in and connect, then yes, you need to set up your ssh keys. If not, then there is more setup you need to do on the server end that is outside the scope of this question.
First, on your workstation you need to set up your public/private keys. You can do this with a command like:
ssh-keygen -t rsa
After hitting enter to accept the defaults, you should get some files in your ~/.ssh folder.
Now you need to add your public key to the authorized_keys on the server account you use for your git operations (You will need to enter a password for this operation)
cat ~/.ssh/id_rsa.pub | ssh user#server 'cat >> .ssh/authorized_keys'
You should be able to both interactively ssh into the server and use git to clone from the server.

Laravel Envoy with Vagrant: Permission denied (publickey)

Trying to use Envoy via Vagrant (Homestead) to deploy to a server on EC2 that I would normally use a .PEM file when I SSH into it.
When using: #servers(['web' => 'ec2-user#myserver.com']) in my Envoy.blade.php
I get: Permission denied (publickey).
Any help would be huge!
Answer is here: https://stackoverflow.com/a/32088143/13346162
You need to pass the -A (as per the man page it - Enables forwarding of the authentication agent connection. This can also be specified on a per-host basis in a configuration file) in you ssh string.
You will also need add your ssh key for agent forwarding (on the machine which can access the git remote which I assume be your localhost)
ssh-add -K ~/.ssh/your_private_key
Something like this
#servers(['web' => '-A user#domain.com'])
#task('deploy')
cd /path/to/site
git status
#endtask
Git remote commands should now work.

How to push to heroku behind a proxy?

I am using git behind a proxy server at my university. While trying to execute
git push heroku master
I get an error
ssh: connect to host proxy.heroku.com port 22: Bad file number
fatal: The remote end hung up unexpectedly
I had a similar problem when pushing to git earlier, but that was solved using their smart HTTP. From what I've read so far, it seems to be a network problem. How do I fix this? Is there any way to push to heroku using HTTP? (I'm guessing pushing through SSH is causing this problem and that the port 22 is blocked)
Corkscrew is a tool for tunneling SSH through HTTP proxies
Setting up Corkscrew with SSH/OpenSSH is very simple. Adding
the following line to your ~/.ssh/config file will usually do
the trick (replace proxy.example.com and 8080 with correct values):
ProxyCommand /usr/local/bin/corkscrew proxy.example.com 8080 %h %p
Follow http://www.agroman.net/corkscrew/README
Heroku only supports git pushes over SSH (port 22) - it's likely that your university is preventing outbound port 22 access which causes your push to fail.

Setting openssh port in windows for msysgit

A quick question. I am using msysgit with openSSH as a git client. i don't want to use other ssh clients such as putty. From GIT Bash I have succesfully connected to my server with ssh -p XXXX to my sever.
Unfortunately when i try to do something like:
git clone git#SERVER:reponame.git
from the Git Bash I get:
ssh: connect to host SERVER port 22 failed.
How can I make the ssh connection that msysgit tries to open with openssh run at a different port?
I know that in linux such a thing would be in /etc/ssh/ssh_config file but how would I go about doing that in this case? Thanks in advance.
git supports the following syntax for ssh://
ssh://[user#]host.xz[:port]/path/to/repo.git/
Note the port in there.

Resources