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?
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.
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.
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.
In your heroku account, go to your app -> Settings. Under App Information, you'll find the heroku git url.
You just need clone you git repo link by your heroku app.
git clone [email protected]:<YOUR_APP>.git
In 2014, you could do
heroku git:clone -a <your-app-name>
Documentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With