Why do I see a message 'You appear to have cloned an empty repository' when using `heroku git:clone`?


You've deployed an application to Heroku and when you attempt to clone the project using heroku git:clone you receive the error 'You appear to have cloned an empty repository'


This error message occurs when deploys to your application have been made via our platform API - typically these are deploys from a Heroku Button click.

You can easily link a Heroku Button app to a repo so you can make changes to the source and deploy it again.

  1. Deploy the app with Heroku Button and remember the app name (<YOUR-APP-NAME> ) that you created.

  2. Go back to where the Heroku Button was displayed and copy it's underlying URL. (e.g. https://heroku.com/deploy?template=https://github.com/jamesward/heroku-connect-phone-change)

  3. Now extract the https://github.com/ part so from the above example you'd be left with https://github.com/jamesward/heroku-connect-phone-change (<YOUR-REPO-URL> ).

  4. Clone the repo with heroku git:clone -a <YOUR-APP-NAME> - it will be reported as empty - that's ok.

  5. cd into the project and add a git remote pointing at the original source. (e.g. git remote add origin <YOUR-REPO-URL>)

  6. Pull from the remote origin git pull origin master

You will now have the code for the deployed application and you can make changes to it locally and deploy it back to Heroku.