ravenUSMC
ravenUSMC

Reputation: 517

Heroku issue with Rails 4 app

I am working on getting a site up on the web through heroku. I have done this four times before but on the fifth I ran into some issues. To start, I did successfully get the app up but it was a test app. I decided to delete it and get the same code up but under a different name. (I know maybe should have asked here how to change the name.) Anyways, after I deleted the app on Heroku and tried to push the app again I got this message, which came right after git push heroku master:

remote: !   No such app as food-test.
fatal: repository 'https://git.heroku.com/food-test.git/' not found

On Heroku the apps name, that I deleted, was food-test. In Github and on my desktop the rails project is called food_blog. The new name that I wanted to call the site, on heroku, was chefwife. Anyways, I looked here on heroku to try and solve this problem and got what I thought was a response. So, I did what the answer said which was to type the following two lines:

git remote remove heroku 
git remote add heroku https://github.com/ravenusmc/Food_blog.git

I thought everything was fine but when I type git push heroku master it asks me for my github username and password and pushed there. This is where my problem is. How do I get it to push to Heroku again? If I go a git remote -v I see the following:

heroku  https://github.com/ravenusmc/Food_blog.git (fetch)
heroku  https://github.com/ravenusmc/Food_blog.git (push)
origin  https://github.com/ravenusmc/Food_blog.git (fetch)
origin  https://github.com/ravenusmc/Food_blog.git (push)

Any help in solving this problem will be a great help! Have a great day!

Upvotes: 1

Views: 45

Answers (2)

Roshan
Roshan

Reputation: 915

It is best if you connect your github repo to heroku and allow automatic deployment. This will make your life easier.

Please refer https://devcenter.heroku.com/articles/github-integration to get it done.

Upvotes: 0

Qaisar Nadeem
Qaisar Nadeem

Reputation: 2434

okay let's understand what's happening here. when you create an app with Heroku with heroku create APP_NAME It creates a new app on Heroku and add a new remote to github repository with the name heroku and set the reference for this remote meaning when you will push to heroku with git push heroku master it knows where to push code it will be something like https://git.heroku.com/APP_NAME.git

So it will push the code to this link.

When you deleted the app from heroku this link became invalid so that error occurred.

After that you ran git remote add heroku https://github.com/ravenusmc/Food_blog.git which is saying add a new remote reference to github which is still pointing to your actual github repository. So when you will push the code this will be pushed to your github repository which is https://github.com/ravenusmc/Food_blog.git

So all you had to do was create a new app for heroku it will add the new reference named heroku and will work fine. So here are steps to fix it.

git remote remove heroku

heroku create chefwife #This will create a new app and add the reference to your new app.

after that everything is cool you can check the remotes again by git remote -v as you will see it will be like

heroku https://git.heroku.com/chefwife.git

If you have already created your app then you can just add a new remote reference by

git remote add heroku https://git.heroku.com/chefwife.git

Upvotes: 2

Related Questions