How to use a heroku app that already exists - ruby-on-rails

please help me,
when I want to upload an rails app to heroku I do this sequence and works creating a new project on heroku
git init
git add .
git commit -m "init"
heroku create
git push heroku master
and then I get a new url like http://-somethingdiferent-.herokuapp.com each time that I need to deploy an project
I dont know how to use that project later without creating other new heroku project
I was thinking to use something like pull of git, but I dont know how is the pull on heroku, maybe -git pull heroku master? but in that case, how can I pull the same project?
please I will like if you know the sequence or any tutorial?
thanks

Try to create an app first
# run this command from the app folder to create a new app
$ heroku open --app the-app-name
# Add it to the remote
$ heroku git:remote -a the-app-name
# push app to heroku
$ git push heroku master
the-app-name shall be replaced by the application name.
one can find more useful stuff here.

Related

How to access Heroku from command line if directory has been deleted

A little while ago the files on my Macbook Pro were deleted by Apple, including a directory from which I used to access Heroku and be able to do command line operations in the Ruby/Rails console. Now that the directory is gone, I'm not sure if it's possible to access this repository from the command line, which I need to do to reduce the size of my database to stay within Heroku limits.
Update
before the directory was deleted on my mac, I used to simply cd into that directory and then run something like bundle exec heroku run console or heroku run bundle exec console, anyways if I did it from that directory heroku knew which application i was trying to access and it would take me into the rails console for it (where I could manipulate data)
Install the Heroku toolbelt (it's unclear whether you still have that)
From the terminal, perform a heroku login to authenticate
From a directory where you want the new app to live, run heroku git:clone APP-NAME
You'll now have a directory, which will have the latest files you pushed to Heroku - which will allow you to do things like git push heroku master, or heroku run rails console.
You probably want to then also attach your git repo where you are storing your source code with something like git remote add origin git#github.com:whoyouare/app-name.git
From the Heroku docs:
You can also take an existing Git repo and add a remote using the git URL provided when you created your app. You may need to do this to associate a Git repo with an existing application. The heroku git:remote command will add this remote for you based on your applications git url.
$ heroku git:remote -a falling-wind-1624
This will add your Heroku repo with the remote name of heroku to your working directory.

Ruby on Rails: Pushing to heroku - keys error

I have recently moved my app from a linux machine to windows, and I am trying to set it up with heroku again. There are problems with my keys, so I am just wanting to push the app up as a brand new app.
I do, git init, then git add ., then git commit -m "init", and now I do heroku create.
I want to just push my folder up to the new app cedar, but everytime I run git push heroku master is tries to push to the old one, and an error flags as my keys don't match.
Anyone have any ideas? Thanks
Execute heroku auth:logout to logout, then heroku auth:login to login again.
To read full help message, try
heroku help
heroku auth
It seems that you're calling heroku apps:create wrongly? Take a look at the documentation here.
Also, the deployment documentation might be more useful for you if you already have a git repository setup.

Avoid needing to declare "-a" on Heroku

This should probably be a super easy question but I can't figure out what I have not done properly.
I run 5 apps on Heroku, on my first three ones I can use commands as:
git push heroku
whereas the new ones I have to explicitly declare
git push git#heroku.com:myappname.git
For the old ones, if I am in the correct folder on my local app I can use commands such as:
heroku logs
to see the logs of that app on Heroku, whereas with the new ones I have to specify
heroku logs -a myapp
It seems like I have missed something with my git "connection" with Heroku.
What have I missed?
The heroku git repo is not associated with your application, use:
git remote add heroku <repo_name>

rails app in development doesn't show up on heroku

Im developing a rails app. Following this tutorial here:
Tutorial
I finished a part and wanted to push all the changes up to heroku and view them there. I can view the site on my local machine. On heroku all I see is this:
I typed in the following commands after I made my changes, saw the site was working on my local computer.
$ git add .
$ git commit -m "Finish layout and routes"
$ git checkout master
$ git push
$ git push heroku
$ heroku open
I even looked at the heroku logs but couldn't make sense of whats going wrong! There is no content in my database, its empty. I just have views setup.
Why did you checkout to master? Are you working on another branch?
If that is the case, you will need to merge your changes to master before pushing your code (supposing you are on master which is already the case after the checkout):
git merge other-branch
Also don't forget to migrate your database on heroku.
heroku rake db:migrate
EDIT
To find out your current branch, type:
git branch
It will mark the current branch with a '*'.
If you have removed the public/index.html file, you'll have to do git rm public/index.html as well, then commit and push to Heroku. If you delete a file locally, git won't pick up on that without doing the git rm, and Heroku's knowledge of your app is 100% through Git.
I had a similarly strange (but unrelated) problem when I had an app that was storing uploaded files on Heroku. Every time I'd do a push they'd all go away. It confused me greatly until I realized that Heroku essentially wipes every time you do a push, and anything that isn't in git isn't kept. A good reason to use S3 or similar for uploaded file storage.

Using external hard drive, heroku 2.4.0 commands are not working

I've configured the keys to my heroku, and I've gotten far enough to be able to commit and push onto my heroku server. But for some reason, commands like "heroku logs" or "heroku rake" or "heroku restart" bring up "no such file or directory" errors. Similarly, heroku restart -app "" bring up an "app not found!" even though I'd typed everything correctly.
I think this may have to do with my Github repo being stored and written on an external hard drive. Is this possible?
Thanks in advance!
An external hard drive will have nothing to do with this problem.
Make sure you are in your app.
cd myap
Then you need to create a repo and add your project to it:
git init
git add.
git commit -m 'master'
Then you need to create a heroku project:
heroku create
heroku rename myapp
git push heroku master
Make sure you have done all of that in that order.
Are you sure you are in the project folder that your application lives in. It doesn't matter where the project is as git and the project git config (including remotes) will all be local to the project folder iteself.
Also, you don't actually need to be in the project folder if you explicitly pass the application name,
eg;
heroku rake db:migrate --app myappnamehere
This also arises if you don't have your heroku remote not named heroku. Eg, I typically call my heroku remotes based off the environment eg, production, development. So my typical push looks like;
git push production mybranch:master
In this scenario when you issue a heroku command it is unable to locate the application name which is does by inspecting the git config for a 'heroku' remote so it will always say application not specified which is why you then need to pass it in explicitly via --app attribute.

Resources