alejoss alejoss - 1 month ago 13
Git Question

Can't pull from Heroku. Couldn't find remote ref master

This is what I did:

heroku git:remote -a myapp

git pull heroku master

fatal: Couldn't find remote ref master


myapp is an existing project, it is not new.

What am I doing wrong? How can I pull from Heroku?. Which branch name should I use?

Edit

The output of git remote -v:

heroku https://git.heroku.com/myapp.git (fetch)
heroku https://git.heroku.com/myapp.git (push)
origin git@git.fullstack.ec:misuper/myapp.git (fetch)
origin git@git.fullstack.ec:misuper/myapp.git (push)


Also, I tried
git clone
in a new folder and it gives me the message "You appear to have cloned an empty repository". It is not empty.

And I tried doing the same thing with a different app and it worked correctly.

I'm lost here.

Answer

Here are some things to consider, and hopefully get you moving:

  • While Heroku uses 'git' to manage the movement of code to/from Heroku, it is itself not a code repository in the more general sense of Github

  • use heroku git:clone -a your-app-name to clone an existing app into your local project directory

  • use git push heroku master to push your code for to Heroku for execution

You should be using Github or some other version control system to manage the actual lifecycle of your source code, eg Pulls, Branches, Merges, &c...

Regarding the error you ran into when trying to execute the heroku git:clone... - how did the application myapp come to be in Heroku in the first place? If you initially created the app using the Heroku Button on a Github repo, there is a bug today which results in the app being created, and the code deployed, but the source is not stored in the internal Heroku repo. If this is the case you will need to

  1. git clone the original repo to a local dir
  2. heroku git:remote -a myapp to add Heroku as a remote repo
  3. git push heroku master to deploy the code to the Heroku repo