Is it possible to retrieve your source code from heroku?

Viewed 45903

Once you have uploaded your source code to Heroku, is it possible to download it from there if necessary such as in the case of a failure of your local disk?

Because of heroku's integration with git, I would assume this might be possible at least in theory.

6 Answers

For the next person that comes across this and did not deploy using git, https://help.heroku.com/FZDDCBLB/how-can-i-download-my-code-from-heroku

Downloading the application slug

If you have not used git to deploy your application, or using heroku git:clone has only created an empty repository, you can download the slug that was build when you application was last deployed. First, install the heroku-slugs CLI plugin with heroku plugins:install heroku-slugs, then run:
heroku slugs:download -a APP_NAME

This will download and compress your slug into a directory with the same name as your application.

Related