restoring git repository from bundle backup

i created backups of my git repository like in How to backup a local Git repository? proposed
with

git bundle create /tmp/foo-all --all

I can see all refs are in there, including a remote ref created by git-svn.
Now I can’t figure out how to restore this bundle to a local repository again.
I am quite quite sure i’ve done it already once. I tried git-clone but that gives me a just a repository with my backup bundle as remote repo.

  • Add/commit to bare repo from a non-git folder
  • Tips for using CVS or Subversion as a backup framework for office documents
  • Maintaining and synchronizing a mirror remote Git repository
  • Daily and weekly backup strategies
  • Attaching a binary to a Git tag
  • Nested and independent GIT repos, for Backup, how?
  • I also tried

    git init
    git bundle unbundle /tmp/foo --all 
    

    but this just lists all references…

    Verifying the bundle gives:

    $ git bundle verify $somewhere/foo.bundle 
    The bundle contains 12 refs
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/heads/xxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/heads/xxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/heads/xxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/heads/xxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/heads/xxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/heads/xxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/heads/xxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/heads/master
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/heads/xxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/heads/xxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx refs/remotes/git-svn
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx HEAD
    The bundle requires these 0 ref
    $somewhere/foo.bundle is okay
    

  • how to download single folder OR file in gitlab repository
  • How a detached node could merge into a git branch?
  • How to make git consider .strings files as text file instead of binary file
  • I can't commit (your branch is up-to-date with 'origin/master')
  • Why does `rm -rf` behave differently when used in a git post-receive hook as opposed to shell?
  • Git Squash by author - All author commits into a single commit
  • 3 Solutions collect form web for “restoring git repository from bundle backup”

    Short answer:

    $ git bundle verify $somewhere/foo.bundle
    $ git clone $somewhere/foo.bundle
    Cloning into 'foo'...
    Receiving objects: 100% (10133/10133), 82.03 MiB | 74.25 MiB/s, done.
    Resolving deltas: 100% (5436/5436), done.
    $ cd foo
    $ git status
    ...
    

    Lazy Badger said this, but it’s in the last paragraph. 🙂

    Bundle contain not files, but deltas, you need the base in order to recreate the file content.
    You have to clone first, unbundle later. Init instead of clone allowed only in case, where bundle requires 0 refs

    Don’t ignore git bundle verify before unbundling

    git-bundle(1) – Linux man page

    Used to check that a bundle file is valid and will apply cleanly to
    the current repository. This includes checks on the bundle format
    itself as well as checking that the prerequisite commits exist and are
    fully linked in the current repository. git bundle prints a list of
    missing commits, if any, and exits with a non-zero status.

    If you are creating the repository, then you can clone from the bundle as if it were a remote repository instead of creating an empty repository and then pulling or fetching objects from the bundle

    I newer version of git is enough to do:

    git clone bundle.file
    

    the whole commands:

    mkdir ~/git
    cd ~/git
    git clone /path/to/bundle.file
    

    It will restore completely Your’s git bare repository content (which will compile as it is normal source).
    You don’t need any other file. The bundle file is enough.

    It is wise to always verify You bundle file before unbundle as follow:

    git /path/to/bundle.file verify 
    
    Git Baby is a git and github fan, let's start git clone.