views:

107

answers:

3

When I attempt to push to my heroku.com remote git repository, i get this message:

ssh: connect to host heroku.com port 22: Connection refused

I can easily work with my repository on github with the same ssh key.

Entering:

$ssh [email protected]    #outputs: success message
$ssh [email protected]    #outputs: ssh: connect to host heroku.com port 22: Connection refused

I'm on Mac OS 10.6. And I'm very clueless slowly learning!

UPDATE:

$telnet heroku.com 22

gives this output:

Trying 75.101.145.87...
telnet: connect to address 75.101.145.87: Connection refused
Trying 75.101.163.44...
telnet: connect to address 75.101.163.44: Connection refused
Trying 174.129.212.2...
telnet: connect to address 174.129.212.2: Connection refused
telnet: Unable to connect to remote host
A: 

You need push your key to heroku.

Because heroku and github are two distinct service. They don't share your key.

shingara
sorry, see updated post. i'm new to ssh in general. what I mean is i just configured an ssh key for the first time.
Matt H.
i ran the command $heroku keys:add /Users/<username>/.ssh/id_rsa.pub with success, but i'm still getting the connection error when i try $ssh [email protected]
Matt H.
Matt, try `telnet heroku.com 22` to check that the service is actually running. You should see something like `SSH-2.0-OpenSSH_5.1p1 Debian-5pgsql1`
Frank Shearar
tried... updating my post with the results...
Matt H.
So running "telnet heroku.com 22" is giving me an error (see updated post), contrasted with how running "telnet github.com 22" gives me the results you predicted (SSH-2.0-....etc.). Does that mean something is wrong on heroku.com's end?
Matt H.
Or something in the middle. See my edited answer for another debugging tip.
Frank Shearar
+2  A: 

Connection refused is a TCP error message saying that that server isn't running a service on that port. In this case, perhaps heroku.com's SSH server wasn't running.

If you haven't given them your key, or you use the wrong private key, ssh will say something like this:

frank@roke$ ssh [email protected]
Permission denied (publickey).

frank@roke$ ssh -i ~/.ssh/roke-frank.priv [email protected]
Permission denied (publickey).

(And the above messages indicate that right now heroku's SSH server is indeed running.)

Since you're not able to connect to the same server to which I can, perhaps there's a firewall issue. Are you behind a NAT? Does your gateway permit connections to port 22 on remote machines?

That machine runs a web server too, so try telnet heroku.com 80 to see if you can connect to that machine at all.

Frank Shearar
TCP error... any suggestions then?
Matt H.
telnet heroku.com 80 is successful...$ telnet heroku.com 80Trying 75.101.163.44...Connected to heroku.com. ---- i am not behind a firewall, AND what's really weird is $ssh [email protected] has no issues.. (and if I run ssh -v [email protected], i can see that it is connecting at port 22)
Matt H.
Time to ask tcpdump. Try something like `tcpdump -i <your interface> -vX -s1024 host heroku.com and port 22` and let's see the output.
Frank Shearar
so i wasn't sure what to put for <your interface> (i know very little about networks). from a little googling, it looks like some options were en0, en1, fw0, and lo0. I tried with all these (i had to do 'sudo' to get anywhere with it). After hitting enter I would see `tcpdump: listening on en1, link-type EN10MB (Ethernet), capture size 1024 bytes` and then a flashing cursor. Nothing happens... If I press Ctl+C to exit, it displays: `0 packets captured / 0 packets received by filter / 0 packets dropped by kernel` was any of that helpful? thank you SO much for your time
Matt H.
one other thing, i connected to my neighbor's unsecure wifi, and had all the same problems. so this leads me to think the problem is either a) on my system, or b) with my ISP. ... but i still can't wrap my head around why I can SSH git github on port 22, but not heroku.
Matt H.
@frank. Ok i'm getting a little more hang of these command line items. What I tried: `$tcpdump -i en1 -vX -s1024 host heroku.com and port 22` in a second terminal window I ran `ssh [email protected]`... NOTHING happened in the tcpdump window. By contrast, when I tried `... host github.com and port 22`, and ran `$ssh [email protected]`, I got LOTS of output in the terminal.
Matt H.
@frank, ok one last thing! The people at heroku's tech support got back to me and said I probably have peerguardian or something similar that is causing problems. (i have peerguardian installed but it isn't running at present). to quote them specifically, they said "Most of the time, we find users who have software that is blocking ec2/amazon." maybe that helps?
Matt H.
SOLVED!!!!!!!!!
Matt H.
I did some digging and found out that peerguardian had two processes runnning in System Profiler, even though the app wasn't running. I completely uninstalled PeerGuardian and re-ran telnet heroku.com 22. Success!
Matt H.
@Matt Congratulations!
Frank Shearar
+1  A: 

It seems ssh-server wasn't working or host was offline. I think it was temporally trouble.

I'm trying now:

telnet heroku.com 22
Trying 174.129.212.2...
Connected to heroku.com (174.129.212.2).
Escape character is '^]'.
SSH-2.0-OpenSSH_5.1p1 Debian-5pgsql1

Anyway you can diagnose doing ssh -v [email protected] (or -vv)

mapcuk
the result: OpenSSH_5.2p1, OpenSSL 0.9.8l 5 Nov 2009 \\ debug1: Reading configuration data /etc/ssh_config \\ debug2: ssh_connect: needpriv 0 \\ debug1: Connecting to heroku.com [75.101.163.44] port 22. \\ debug1: connect to address 75.101.163.44 port 22: Connection refuseddebug1: Connecting to heroku.com [174.129.212.2] port 22.debug1: connect to address 174.129.212.2 port 22: Connection refuseddebug1: Connecting to heroku.com [75.101.145.87] port 22.debug1: connect to address 75.101.145.87 port 22: Connection refusedssh: connect to host heroku.com port 22: Connection refused
Matt H.
`ssh -v` won't help (in this case): as you can see, it's a TCP problem. Connection refused means that negotiating the SSH session hasn't even started.
Frank Shearar