Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku clone creates an empty folder

Tags:

heroku

So I am trying to learn heroku and yesterday from another computer I created an app. Today, from a different computer I am trying to clone the app (download the code) and keep working on the same app so I did this

heroku git:clone -a myappname

I get the message

warning you have appeared to have cloned an empty directory

The app is running online so the code must be there.

According to the documentation this command does this

This will create a new directory named after your app with its source and complete repository history, as well as adding a heroku git remote to facilitate further updates.

However, the repository is empty.

I saw the question below but I that didn't work for me. How can I simply get the code locally and keep working on this app without creating a new one? Thanks.

Why am I getting an empty repo when cloning my keystone app to local repo from heroku?

like image 346
PepeFloyd Avatar asked Apr 14 '16 11:04

PepeFloyd


1 Answers

This is counterintuitive, but looks like it is by design at Heroku. You don't copy from Heroku git to local drive, but the other way around - from your PC to Heroku.

You need to create or clone a repository on your local PC.

git create <new repository> OR

git clone <source>

then init your repository and commit code:

$ cd myapp
$ git init
Initialized empty Git repository in .git/
$ git add .
$ git commit -m "my first commit"

Then you need to link your repository with Heroku. Download their Toolbelt and run:

heroku git:remote -a your_app_name_on_heroku

And deploy code:

 git push heroku master

Hope that helps. I had to open a ticket at Heroku to figure this out. Check Heroku Git instructions for further reference.

like image 171
Dmitri Borohhov Avatar answered Oct 08 '22 23:10

Dmitri Borohhov