2

I need to restore some repositories from an gitlab backup. This backup contains .bundle files for all the repos. How can I restore the complete respository with all branches in it?

If I run git bundle list-heads myfile.bundle I can see all the branches.

I want to restore that repo locally with all branches to push it to a new/empty gitlab repository.

I've tried to use git clone, git pull all other tricks i could find but that only leads to a repo with only the master branch in it.

kannix
  • 5,107
  • 6
  • 28
  • 47

1 Answers1

6

If the bundle was create with all branches, you should be able to see all the branches after a git clone --mirror:

git clone --mirror /path/to/your/bundle yourRepo.git

Note the .git since the --mirror would create a bare repo.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • but pushing to another remote, bare git repo does not push the tags and prior branches e.g. git tag shows them on the local repo (the steps above) but not on a new clone after that is pushed to the other remote. Why! – codeslapper Sep 26 '17 at 16:40
  • @codeslapper did you try git push --tags? (https://stackoverflow.com/a/3745250/6309) But first, do you have the tags included in the bundle? (https://stackoverflow.com/a/5720366/6309) – VonC Sep 26 '17 at 18:32
  • yes. Turned out when they created the bundle they did not use the right arguments. Later we moved to pull-push. You have to git checkout each and every branch, then can push to the new empty repo. So easy. :-) – codeslapper Oct 24 '17 at 18:47