0

I got a Git bundle (client.bundle) with several branches that I need to import in my project. I was able to import a single branch by cloning it locally, changing the remote URL and pushing it. However I can't push the other branches.

$ git clone ./client.bundle project1
$ cd project1
$ git remote set-url origin git@my.git:username/myrepo1.git
$ git push -u --all
Branch 'master' set up to track remote branch 'master' from 'origin'.

Now I have:

$ git remote -v
origin  git@my.git:username/myrepo1.git (fetch)
origin  git@my.git:username/myrepo1.git (push)
$ git branch -a
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/branch2
  remotes/origin/master
  remotes/origin/branch3

Note: The last four branches remotes/... show up in RED!

When I try to push another branch I get an error:

$ git push origin branch3
error: src refspec branch3 does not match any.
error: failed to push some refs to 'git@my.git:username/myrepo1.git'

How can I push them all?

Joe DiNottra
  • 836
  • 8
  • 26
  • https://stackoverflow.com/search?q=%5Bgit%5D+error%3A+src+refspec+does+not+match+any – phd Oct 28 '20 at 22:52
  • You don't appear to have a local branch named `branch3`. You have a *remote* branch named `branch3` associated with your `origin` remote. – phd Oct 28 '20 at 22:53
  • @phd Thanks. Does this mean the bundle did come with a remote "branch3", or not? If it came with it, I need to push it to the new repository. I'm sorry I still can't see clearly. – Joe DiNottra Oct 28 '20 at 23:02
  • It came with its own local branch `branch3`; `git clone` made it remote. See how to clone all branches: https://stackoverflow.com/q/67699/7976758 – phd Oct 28 '20 at 23:20
  • @phd Thanks again. That helps a lot. The bundle comes with 15 branches, so I guess I have to work on it one by one. – Joe DiNottra Oct 29 '20 at 00:26

0 Answers0