‘git push heroku master’ Error – operation timed out

Home / Blog / ‘git push heroku master’ Error – operation timed out

CAUSE

My remote fetch/push URL for heroku got screwed up. Not sure how, though.

ERROR

$ git push heroku master
ssh: connect to host heroku.com port 22: Operation timed out
fatal: Could not read from remote repository.

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

SOLUTION

First verify in Terminal you have the correct remote URL for pushing to heroku, and then change it if necessary:


1. Enter your git folder

cd /path/to/my/git/project

2. Check remote URLs

git remote -v

3. Inspect the output

heroku  git@heroku.com:my-heroku-app.git (fetch)
heroku  git@heroku.com:my-heroku-app.git (push)
origin  git@github.com:my-git-username/my-heroku-app.git (fetch)
origin  git@github.com:my-git-username/my-heroku-app.git (push)

EXPLANATION

The above is what the output should look like. In my case, the top two lines were formatted as git@heroku.my-heroku-app, and when I changed them to git@heroku.com it stopped timing out. Heroku was trying to push the git repository to an address where it didn’t exist (or was formatted wrong), and thus timed out in the process.

Hopefully this helps someone else!

Recent Posts
Contact Us

We're not around right now. But you can send us an email and we'll get back to you, asap.