“unqualified destination” error with git subtree push

I just created a new Heroku app and I don’t manage to push the subtree folder backend of my repo (branch staging) to the newly created app myapp-staging (no branch yet).

Here is how I push the subtree:

  • GitHub issues - Reference a file in the repo
  • How to commit & push selected files but not all in Git
  • How to compare source in Git repository between source in SVN repository
  • Undo a git push on github
  • Git submodule or sub-repository or remote?
  • What's the use of `-u` in `git push -u origin master`?
  • git push heroku `git subtree split --prefix=backend staging`:master
    

    An the related error:

    error: unable to push to unqualified destination: master
    The destination refspec neither matches an existing ref on the remote nor
    begins with refs/, and we are unable to guess a prefix based on the source ref.
    error: failed to push some refs to 'git@heroku.com:myapp-staging.git'
    

    I tried git fetch heroku. What does this “unqualified destination” mean? Shouldn’t this command create the distant branch?

  • Difference between `git rm --cached` and `git update-index --assume-unchanged`?
  • How to use Git with “multiple (thousands) projects” in one-repo?
  • git: repo monitoring tool
  • git pull via PHP exec IIS
  • Converting big bzr repository to git, what to expect?
  • Git post-receive hook to update a local clone owned by a different user
  • 2 Solutions collect form web for ““unqualified destination” error with git subtree push”

    Ok, got an idea thanks to http://makingsoftware.wordpress.com/2013/02/16/using-git-subtrees-for-repository-separation/

    I tried:

    git subtree split --prefix=bakcend -b test
    git push heroku test:master
    

    And it worked like a charm. May the problem would be with the creation of the branch using the subtree command…

    As discussed here, you can push to refs/heads/master to fix this problem, after which you can change back to master, although I’m still not entirely sure /why/ this works.

    # run this once
    git push origin master:refs/heads/master
    
    # now you can use this forever
    git push origin master
    
    Git Baby is a git and github fan, let's start git clone.