How can I download my code from Heroku?


You need to recover your application source code from Heroku.


Cloning the git repository

If you have deployed your application via our git push heroku master method, or via Heroku Pipelines, you can download the latest revision from our git servers with:

heroku git:clone -a APP-NAME

This will clone the git repository to your machine with the latest code. Please note, this will only include branches that you have pushed to Heroku, which in most cases will only be the master branch.

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.

  1. Determine the release version number you want the code/slug to be downloaded from. The CLI command heroku releases -a <app_name> will show you all releases for your app.

  2. Run heroku slugs -a <app_name> to find the slug ID for the particular version selected. You'll need to install the Heroku Slugs CLI Plugin first if you haven't already.

  3. Run heroku slugs:download <slug_id> -a <app_name>.

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

Ask on Stack Overflow

Engage with a community of passionate experts to get the answers you need

Ask on Stack Overflow

Heroku Support

Create a support ticket and our support experts will get back to you

Contact Heroku Support