heroku rejecting git push with error message showing stale files - ruby-on-rails

My rails app has only one branch, main When I view the file causing the error on the github site page for my repository it shows the updated code, but the error message I receive from Heroku shows the old code still causing the same error It also says I must now use git push heroku <branch-name>:main What does that mean? It seems redundant Maybe they mean repository-name:main? I tried running git push heroku main:main and it fails with the same error showing my old outdated code

Related

Heroku app removal

Rails 4 application.
Using Cloud9 editor (Not AWS)
Question:
I was getting several errors in my Heroku app when I tried to push my completed work. It was showing a Segmentation fault error. My mentor suggested I delete and recreate the app and try to redeploy. Like the noob that I am, I deleted the application from my Heroku repository instead of destroying it in my Rails console. I proceeded to with a heroku create command and created a new app. However, when I went to git push heroku master it references the old app and gives a fatal: repository 'https.....' not found error.
How do I destroy the old app when the repository is still referenced/embedded in my code. Any suggestions would be greatly appreciated.
from your command line, execute heroku apps:destroy
if it doesn't work, check your Git remote repository list by executing git remote -v
if there is "heroku" in the one of the list, then delete it by git remote rm heroku
and then create new Heroku app as what you do usually

Opening Heroku | Page not found

I'm following this tutorial to a tee and so far so good. I ran into a problem on step 2.6
On my terminal I input
heroku open
After which it opened a new webpage on Chrome.
The terminal then displayed
Opening aqueous-forest-3891... done
The webpage that opened was https://aqueous-forest-3891.herokuapp.com/ and unfortunately it says the webpage may have been moved or does not exist.
I've followed the tutorial exactly (as far as I can tell) and can't figure out what I've done wrong. I'm very new to Rails (and Ruby....and Heroku...).
I'm not exactly sure how to troubleshoot my problem or if there's a command I can use in my terminal for debugging - etc.
Good news: a Rails error means your app is running on the server
Bad news : your routes are likely causing a problem.
According to this blog (which has exactly the same issue), the problem is that Heroku won't host the "default" Rails page. You'll need to create a default page & redeploy:
#config/routes.rb
root "application#index"
#app/views/application/index.html.erb
Hello world
$ git add .
$ git commit -a -m "Default Page"
$ git push heroku master
Context
The error you're seeing is one from Rails:
This is good, as it means your Rails app is actually on the Heroku server & being picked up. This type of error is either suggestive that you have an error with your server (500 error), or a missing page (404 error).
-
If you had the following error, it would be a Heroku (platform) centric issue:
This is normally caused either by a lack of database connectivity, or some sort of environment issue (ENV vars missing etc).
The best way to debug Heroku is to use the Heroku logs.
These are written - as with most event-based software - on the server, allowing you to see what's going on. Heroku recently upgraded their software to include a new real-time logging system:
Checking in there will tell you what's going on, allowing you to take direct action to resolve it.
To debug your issue you will need to view the logs. A quick way is to add the Papertrail add on to your app (there's a free option). Add-ons can be added via the resources tab from Heroku.
Another option is to to view the heroku logs in the terminal with the command
heroku logs -t --app appName
By viewing the logs, you should get some error messages that will help you debug why your app isn't showing.
In my case I deployed custom branch to heroku master, which; heroku usually does not build itself.
If you want to deploy custom branch to heroku use this command.
git push -f heroku your_branch_name:master

starting with heroku; fail updating rails app

after a few months learning a bit about rails and making some stuff local, I wanted to try to upload a simple rails app to heroku. Which, by the way, was a pain in the ass because of installing issues of Postgresql. But ok, that's done.
Now I create an app on heroku, I did the login, key thing, git, and uploaded. Was fine, very easy after all. I just uploaded an empty rails app, to try heroku.
Well, then I add a controller. Upload again via git push heroku master and not so fine! I did scaffold, for my articulo controller. And I wasn't able to open the URL once pushed to heroke on someurl/articulos. I got an 404 heroku message here: http://enigmatic-scrubland-8865.herokuapp.com/articulos
Then I create a controller for the home site and get rid of the "welcome aboard" default site. Again push heroku... On terminal I got messages all updated, and lauching. All fine.
But then I access and again, the "welcome aboard" default page.
Locally it works fine. But now I'm not sure if I'm doing it well. It scares me that no failing messages are to see nowhere, but obviously it fails.
After editing my rails app, I always do this:
$ git init
$ git add .
$ git commit -m "init"
$ git push heroku master
Like the documentation says on heroku. But, no error and no updating.
Thanks in advice.
From what I see from heroku devcenter, the git init part is only to be done on the first initial creation of the git repo, not "After editing my rails app".
In other words, you shouldn't have to "always do" a git init after editing your rail apps.
For the first push, I would recommend a:
git push -u heroku master
That way, all the subsequent push will be a simple:
git push

(ActionView::MissingTemplate) Error when deploying app to heroku

I have a 'pages' controller with some static pages instead of using the rest method (show, index etc).
The static files view fine on my local machine but when deploying with heroku I get the following error:
PagesController#used_cars_south_wales (ActionView::MissingTemplate) "Missing template pages/used_cars_south_wales.erb in view path app/views"
Anyone else get the same problem, any advice appreciated.
The error message says it all I think. Heroku Rails is looking for app/views/pages/used_cars_south_wales.html.erb but it's obviously not finding it. If it's working locally then that file does exist. That it's not working on Heroku suggests it has not been added and committed to the git repo before pushing your app.
$ git add app/views/pages/used_cars_south_wales.html.erb
$ git commit -m "some comment..."
$ git push heroku master

Pushing app to heroku problem

I am trying to push my app to heroku and I get the following message:
$ heroku create
Creating electric-meadow-15..... done
Created http://electric-meadow-15.heroku.com/ | git#heroku.com:electric-meadow-1
5.git
$ git push heroku master
! No such app as fierce-fog-63
fatal: The remote end hung up unexpectedly
It's weird that I am getting this now, I have pushed the app to heroku many times without issue. the especially weird thing is, fierce-fog-63 is an old app that I made and deleted a long time ago. Why is it now that heroku is trying to push to this app that doesn't exist anymore, especially when I have created a new one? Any suggestions?
Type this and I think you'll see the problem:
git remote -v
Fix it like this:
git remote rm heroku
git remote add heroku git#heroku.com:electric-meadow-15.git
I was getting the second error you posted "failed to push some refs to 'git#heroku.com:floating-stone-94.git' " (with a different app name) and i got rid of it by doing the following:
git remote rm heroku
heroku create
you should see a line that says 'Git remote heroku added'. Also
git remote -v
should now have the correct app.
For all the people who this does not work, check your ~/.heroku/credentials
If the email or token does not match the account, you won't see your apps.
If you got here and think you have a similar problem but all of the other stuff suggested does not work you might want to try:
heroku restart

Resources