Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I retrieve a git repository from Heroku?

I created an app and deployed it to Heroku, but I didn't have a github git repo (I know really bad idea!) and my local git repo has been deleted (just plain stupidity here). So I have no copies of my source. I need to make some updates and the only thing I can think of is doing a checkout from Heroku.

Is there a way to do a checkout from Heroku? Is there a way I can retrieve the source from the Heroku git repo?

like image 261
luis.madrigal Avatar asked Aug 07 '11 19:08

luis.madrigal


People also ask

How do I retrieve files from Heroku?

Open a terminal on your local device. Run heroku run bash. (Inside your remote connection, on the dyno) Run cat filename. Select the lines in your local terminal and copy them to your clipboard.

Can I git pull from Heroku?

Please note that unless you specify a target branch (or you have the tracking branch enabled), git pull will simply download (and not merge) the upstream changes. Also note that Heroku should not be considered a git hosting. It means that it's extremely uncommon to perform a git pull from Heroku.

How does Heroku work with git?

For a New AppThe heroku create CLI command creates a new empty application on Heroku, along with an associated empty Git repository. If you run this command from your app's root directory, the empty Heroku Git repository is automatically set as a remote for your local repository.

What is Heroku git URL?

In your heroku account, go to your app -> Settings. Under App Information, you'll find the heroku git url.


2 Answers

You just need clone you git repo link by your heroku app.

git clone [email protected]:<YOUR_APP>.git
like image 200
shingara Avatar answered Sep 27 '22 23:09

shingara


In 2014, you could do

heroku git:clone -a <your-app-name>

Documentation

like image 26
Thai Tran Avatar answered Sep 27 '22 22:09

Thai Tran