Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to read a single file in Heroku via bash

Tags:

git

bash

heroku

I'm trying to read a file in Heroku because it's an old website where Git got corrupted and I no longer have the files for it. I have rolled back to its version to to read from it and I've gotten to the bash folder where it is using

heroku run bash
ls app/views/

How can I read my file from here?

like image 549
MikaAK Avatar asked Apr 10 '14 22:04

MikaAK


People also ask

How do I access heroku files?

The dashboard can be accessed via the CLI: $ heroku addons:open filepicker Opening filepicker for sharp-mountain-4005… or by visiting the Heroku Dashboard and selecting the application in question. Select Ink file picker from the Add-ons menu.

Can I pull from heroku?

If you've been using git push heroku main to deploy your code, you can pull it down using the heroku git:clone command displayed in the Deploy section of the dashboard for your app. After pulling down your code, you can follow the instructions to push to your destination of choice.

How can I see my heroku code?

Just go to https://dashboard.heroku.com/apps/YOUR_APP_NAME/deploy/heroku-git. If you haven't already, log in to your Heroku account and follow the prompts to create a new SSH public key. Use Git to clone YOUR_APP_NAME's source code to your local machine.

How do I upload a project to heroku?

To deploy your app to Heroku, use the git push command to push the code from your local repository's main branch to your heroku remote. For example: $ git push heroku main Initializing repository, done.


2 Answers

When you are using bash you can just cat the file

heroku run bash -a my-app

and then :

ls app/views/ cat my_super_file

like image 98
Luc Boissaye Avatar answered Sep 21 '22 12:09

Luc Boissaye


The easiest way would be to clone the repo from Heroku and get the files from Git locally.

git clone [email protected]:<your app>.git

git co <revision>

You should then be able to access your files.

like image 33
jordelver Avatar answered Sep 21 '22 12:09

jordelver