Heroku - deploy app from another directory - ruby-on-rails

I had the directory called A from which I deployed a Rails app to Heroku. Now, I moved this project on my localhost to another directory called B and from this B directory I would need to deploy the app to the origrinal Heroku app (to the same app where I deployed the code from A directory).
Is there any way to do that?

You'll need to add the git repo url to B.
git remote add heroku git#heroku.com:YOURAPPNAME.git
and git push heroku master would work.

As long as you moved the .git directory together with the rest of the files, there should be no difference and everything should work as before. If you don't have the .git directory, you will have to set the remote heroku url again.

Related

How to run Heroku rails app locally without access to source code

My Heroku app is created and it also runs in my big commerce store but I want to run in locally.
Basically, I want to get all file in local machine from Heroku app.
Please help..
Since you have access to git repository, you just need to clone it
git clone GIT_URL
then move into the app root directory
cd my_app
and then do
bundle install
now start the server
rails server
goto localhost:3000 from your browser..
Update
Since you have access to heroku, in the app dashboard goto settings near the bottom page you will find Heroku Git URL, clone that.
In a new empty folder just type this from cmd
git clone https://github.com/bigcommerce/hello-world-app-ruby-sinatra.git

Recover files from an Rails app through git cloning the heroku app?

I am a Git/Heroku Newbie and I've lost files from a Rails app which I've also deployed to Heroku. Is it possible to recover the source files from Heroku?
I've found this link which says:
To clone the source of an existing application from Heroku using Git, use the heroku git:clone command:
heroku git:clone -a myapp
Replace myapp with the name of your app.
This will create a new directory named after your app with its source and complete repository history, as well as adding a heroku git remote to facilitate further updates.
I've done this but I don't know where this "new directory" is?
Thank you!
(And of course, next time I should use something like Github).
It was actually possible to copy all of the app's source files from Heroku to my local disk. When typing:
heroku git:clone -a myherokuapp
in my rails app folder (e.g. myapp) the new directory can be found at /myapp/myherokuapp/.

Cant push bin directory to github

I've made an app that works fine on localhost and I was making commits to github, having the repository there. Since I didn't started to make deploy on heroku I didn't noticed that the bin directory from the app folder wasn't pushing to github?? Ive tried everything, deleting the cache, the remote repository, but nothing... Why I cant push the bin directory to github?? Without the bin directory I can't deploy on heroku. Trows me the error: bin/rails directory not found.
I'm a bit confusing and tired of trying to push it to github.
Any suggestions/solutions would be very welcomed.

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.

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