Matt H.
Matt H.

Reputation: 10776

Cannot push git to remote repository: (SSH error)

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

Upvotes: 10

Views: 15714

Answers (4)

Ben Wiseley
Ben Wiseley

Reputation: 547

I just ran into this on stuff that'd been working for ages and suddenly broke on all my computers and all the people I work with so, if it helps. Our problem was that we had our .git/config using @ github urls.

Example: Instead of this

[remote "heroku-some-site"]
  url = [email protected]:some-site.git
  fetch = +refs/heads/*:refs/remotes/heroku/*

Do this

[remote "heroku-some-site"]
  url = https://git.heroku.com/some-site.git
  fetch = +refs/heads/*:refs/remotes/heroku/*

Upvotes: 0

mapcuk
mapcuk

Reputation: 802

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)

Upvotes: 2

Frank Shearar
Frank Shearar

Reputation: 17132

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.

Upvotes: 5

shingara
shingara

Reputation: 46904

You need push your key to heroku.

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

Upvotes: 0

Related Questions