0

I am working on the ruby.railstutorial.org and I am having all sorts of trouble getting my first_app to push from git to heroku. I have tried the solutions listed below but keep getting back the same error messages.

Solutions I have tried: git push heroku master gives error ssh: connect to host heroku.com port 22: Connection refused git push heroku master gives error ssh: connect to host heroku.com port 22: Connection refused

I have tried precompiling as:
$ rake assets:precompile
$ git add .
$ git commit -m "Add precompiled assets for Heroku"

and getting a new ssh key. I can't seem to get anything to work. Here is what I am getting:

Coreys-MacBook-Pro:first_app coreydavis$ heroku create
Creating radiant-oasis-3729... done, stack is cedar
http://radiant-oasis-3729.herokuapp.com/ | git@heroku.com:radiant-oasis-3729.git
Coreys-MacBook-Pro:first_app coreydavis$ git push heroku master
ssh: connect to host heroku.com port 22: Connection refused
fatal: Could not read from remote repository.

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

I know the repository exists and I have access, I can't figure out what I am missing here. Any help would be great, I am very, very new to this and don't totally understand what is going wrong despite my reading and google searches. Thanks so much.

Community
  • 1
  • 1
  • have you renamed the app or created multi heroku apps? You might be trying to push a master to an app that no longer exists. Check out https://devcenter.heroku.com/articles/renaming-apps#manually-updating-a-git-remote and http://stackoverflow.com/questions/6226846/how-to-change-a-git-remote-on-heroku for removing orgin – ChrisBarthol Feb 28 '14 at 19:23
  • Thanks Chris, I found that I did have multiple apps, so I deleted them and tried a to create a new app, but $ git remote -v is still reporting the name of the original app. Is there a way that I can clean and start fresh? – user3353784 Mar 01 '14 at 06:47
  • I've added it as an answer – ChrisBarthol Mar 01 '14 at 16:06

3 Answers3

0

You need to assign a public key to your Heroku account, as described in their docs.

Also, double-check that the git remote is actually the Heroku app repository that you expect it to be.

$ git remote -v

You should see your Heroku app name in the list that comes out of this command.

Another thing to check is that you are not behind a firewall that is blocking port 22. That would be unusual, but not unheard of. There are also various software that will block access to AWS/EC2; make sure you're not running anything like that since Heroku runs on EC2.

jdl
  • 17,702
  • 4
  • 51
  • 54
  • SO I did have multiple apps, so I deleted them on heroku and started over with a new $ heroku create which created a new app. And then I ran $ git remote -v and it reported back the name of the original app that I created. Is there a way that I can clear all of this out and start fresh? – user3353784 Mar 01 '14 at 06:45
  • Oh, and I have assigned a public key, I saved it locally, but still am getting the permissions error. – user3353784 Mar 01 '14 at 06:48
0

I've had this issue before. If you're public key is missing the error usually indicates it. Make sure that you've logged into your GitHub account and created the new repository there first. Then run the following on the command line:

git init
git commit
git remote add origin https://github.com/username/your_repository_name.git
git push
#you should be prompted to enter your github credentials
#your code will then be pushed to your github repository
git push heroku 
#heroku will fetch your your github repository and install to your heroku instance
heroku open
#this will open your heroku instance in a new browser window. 

Good luck!!

Michael Droz
  • 324
  • 2
  • 7
0

If you created multiple apps you'll still only have your original as the remote.

git remote -v

shows you what your remotes are named and the url. Usually you'll have it named origin and you can remove it with:

git remote rm origin

Then you need to add the new heroku app name:

git remote add origin <URL to new heroku app>

Finally push your app:

git push -u origin master

The -u tag will mark it as tracked.

ChrisBarthol
  • 4,871
  • 2
  • 21
  • 24