tBureck tBureck - 2 years ago 114
Git Question

Push a branch into a newly created Bitbucket repository

I'm currently switching over to using mono repos, since it fits my workflow better. However, I still want to be able to deploy/use parts of the now huge project separately. That is why I came across splitsh-lite (https://github.com/splitsh/lite), a replacement for

git subtree

So, my project structure of the main (mono) repository is as follows:

-- some-application/
-- src/
-- -- MyLibrary1/
-- -- MyLibrary2/

mono repo master

Using splitsh-lite, I've managed to extract the contents of the repository that I want to split into an own branch. Let's say I've split MyLibrary1:

-- file1
-- file2

mono repo split/library1

What I didn't manage to do now is getting this newly created branch into the master branch of a fresh repository on Bitbucket (or actually any Git repository). I've mainly tried two variations that seemed logical to me.

  1. git push [email protected]:my-project/my-repo split/library1:master
    , resulting in
    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.

  2. Pushing it to an empty local repository (
    git push ../library1 split/library1:master
    resulting in the same error

I'd appreciate any suggestions on how to continue from here, because I don't really how to go on from here. :(

Best regards

Answer Source

So, apparently the above commands should be working as intended. The issue however is, that Git is somehow not able to resolve "master" into an actual reference. The problem is solved by specifying the exact reference:

git push some-repo-path split/library1:refs/heads/master

Me and some guy from #git (freenode, thanks for helping, again!) couldn't figure out why Git couldn't do it, though, which is a little unsatisfying.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download