Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot 'git push' to Heroku

Tags:

git

ssh

heroku

I cannot git push to Heroku in the normal way from my home. I've tried using two different accounts (home and work), on different apps, with different ssh keys. It's not a corrupted repo because it works from my work computer. (In fact, I normally work around this by ssh-ing to work and deploying from there, but the power went off there so I can't do that this weekend!)

First, this is different from dozens of other questions similar to this, primarily because I am getting no error.

The Error (Non-)Message

$ git push heroku master
Connection closed by 50.19.85.132
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Note that it hangs for exactly 60 seconds before the connection is closed and this is displayed.

$ git push -v heroku master
Pushing to [email protected]:myherokuapp.git
Connection closed by 50.19.85.154
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

What I've Tried

  • heroku keys:add -- the command succeeds, the keys get added to my account (show on heroku.com and I get the email), but nothing changes.

  • Regenerating the keys entirely. Same as above.

  • Removing and re-adding the git heroku repo using both git remote and heroku git:remote commands. (No change.)

  • Debugging the connection with ssh -vvv. (See below.)

Output of Various Debugging Commands

$ git remote -v
heroku  [email protected]:myherokuapp.git (fetch)
heroku  [email protected]:myherokuapp.git (push)

$ heroku apps:info
=== myherokuapp
Git URL:       [email protected]:myherokuapp.git
Owner Email:   [email protected]
Region:        us
Stack:         cedar
Web URL:       http://myherokuapp.herokuapp.com/

$ ping -c4 50.19.85.132
PING 50.19.85.132 (50.19.85.132) 56(84) bytes of data.
64 bytes from 50.19.85.132: icmp_seq=1 ttl=37 time=48.9 ms
64 bytes from 50.19.85.132: icmp_seq=2 ttl=37 time=49.1 ms
64 bytes from 50.19.85.132: icmp_seq=3 ttl=37 time=47.9 ms
64 bytes from 50.19.85.132: icmp_seq=4 ttl=37 time=49.2 ms

--- 50.19.85.132 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 47.997/48.832/49.245/0.498 ms

$ ping -c4 50.19.85.154
PING 50.19.85.154 (50.19.85.154) 56(84) bytes of data.
64 bytes from 50.19.85.154: icmp_seq=1 ttl=41 time=47.8 ms
64 bytes from 50.19.85.154: icmp_seq=2 ttl=41 time=47.7 ms
64 bytes from 50.19.85.154: icmp_seq=3 ttl=41 time=49.7 ms
64 bytes from 50.19.85.154: icmp_seq=4 ttl=41 time=50.0 ms

--- 50.19.85.154 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 47.746/48.855/50.055/1.059 ms

$ ssh -vvv [email protected]
OpenSSH_6.6.1, OpenSSL 1.0.1h 5 Jun 2014
debug1: Reading configuration data /home/user/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: ssh_connect: needpriv 0
debug1: Connecting to heroku.com [50.19.85.132] port 22.
debug1: Connection established.
[ several lines ommitted ]
debug1: Offering ECDSA public key: /home/user/.ssh/id_ecdsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
[ hangs here ]
Connection closed by 50.19.85.132

Additional Information

I'm using Arch Linux, on the same ISP I use at work (although at work we have a static IP), and I have no firewall except whatever is built into my home (Netgear) router, which is set not to block anything. I am not behind a proxy. I can deploy to GitHub just fine from here. For whatever reason, I simply can't even make the connection to Heroku. I know that my public keys are not getting rejected, and that it's simply not connecting in the first place, because the logs don't show anything and there is no activity:

$ heroku logs
2014-08-02T02:12:36.883623+00:00 heroku[api]: Enable Logplex by [email protected]

Update: I have opened a Heroku ticket regarding this issue and am awaiting a reply from their support. I will answer here if they are able to solve the issue.

like image 201
Two-Bit Alchemist Avatar asked Aug 02 '14 16:08

Two-Bit Alchemist


People also ask

How do I force push to Heroku?

To deploy your app to Heroku, use the git push command to push the code from your local repository's main branch to your heroku remote. For example: $ git push heroku main Initializing repository, done.

Why is Heroku not connecting to GitHub?

We are unable to access this connected repository on GitHub The authorization key is not valid, or the account used to connect to GitHub doesn't have access to the repository. Try disconnecting the repository above and then reconnect. That is the error I got when trying to connect my private GitHub repo to Heroku.

Can you push to Heroku and GitHub?

You can now push your project to GitHub and it will be automatically deployed to Heroku henceforth.


1 Answers

Looks like it might be an issue with your security certificate. Heroku doesn't support ECDSA key, per their documentation. I would create a fresh RSA SSH key that you use for heroku and only for heroku, send that new public key to them, then setup a ssh config file to serve that key when SSH reaches out to heroku.com.

This is what I have in my ~/.ssh/config file on my laptop:

Host heroku.com
  IdentityFile /Users/danielrice/.ssh/identity.heroku.danielricecodes
  IdentitiesOnly yes
like image 120
danielricecodes Avatar answered Oct 27 '22 13:10

danielricecodes