I deployed a Heroku application from my previous laptop using git push heroku master
and connected it to my own GitHub repository.
However, when Heroku stopped their free service, my previous laptop died(planning to recycle) while it had all of the source code of the Heroku application.
How can I possibly pull the source code from my dead Heroku application? I don't know if I can use git commands because I git-pushed it using my previous laptop.
I logged into heroku.com and tried to find the source code from my connected GitHub repository but couldn't find it.
CodePudding user response:
I don't know if this will help, but I cant comment, so I need to make an answer.
When your app died, you can acess the app, right? He died, but if you acess heroku you will see the app disabled (I'm not certain about this). If you can do this, access 'settings' section. There you will see the 'Heroku git URL'.
So, you only clone with git clone your-heroku-git-url
.
CodePudding user response:
I deployed a Heroku application from my previous laptop using
git push heroku master
and connected it to my own GitHub repository
This conflates two workflows.
If you connected to GitHub and deployed from GitHub, that means you must have pushed to GitHub. If that's the case, your best bet is to clone from GitHub, not Heroku. GitHub, or something like it, should be your canonical source of truth.
However, if you never pushed to GitHub (it sounds like you might have connected to GitHub after deploying manually), this won't work. Heroku's GitHub integration only works in one direction.
In that case, you can clone directly from Heroku using the Heroku CLI¹:
heroku git:clone -a your-app
That this should not be part of your regular workflow:
A Heroku app’s Git repository is intended for deployment purposes only. Cloning from this repository is not officially supported as a feature and should be attempted only as a last resort. Do not use this repository as your app’s canonical “origin” repository. Instead, use your own Git server or a version control service such as GitHub.
After retrieving your source code from Heroku, you should push it to GitHub immediately and use that as your primary remote moving forward. If you connect that repository to an app on Heroku, pushing to GitHub will automatically trigger a new build on Heroku.
¹Note that Heroku's Git repository may be empty or out of date if you deployed using any method other than git push
. GitHub integration, deploy buttons, Docker deployment, etc. do not populate the underlying repository accessible via heroku git:clone
.
CodePudding user response:
That data must be in your gitrepo, try to find it carefully.