Restoring a Gitlab Bundle

I had an odd request today from a guy who had deleted his GitLab project and his local repos. I had been making backups using:

gitlab-rake gitlab:backup:create

and sifting through the backups under /var/opt/gitlab/backups/  I extracted the latest tar and under the ./repositories/username directory found some .bundle files for each of his projects.

After some piddling about with git bundle unbundle

error: '/path/to/file/userproject.bundle' does not look like a v2 bundle file

I read that the bundle files are now just tar archives so I extracted the bundle file. e.g.

tar xf userproject.bundle

then noticed the familiar directory layout:

config  description  HEAD  hooks  info  objects  refs

Although I did not have the working files and some of the git commands I ran gave the error:

fatal: This operation must be run in a work tree

So I created some empty directories e.g.

mkdir /tmp1 /tmp2

I then moved the extracted bundle files so that they were contained under /tmp1/.git

I then used a git clone to recreate the files from the bundle into a new directory:

git clone -l /tmp/ /tmp2/

This gave a working copy of the files he needed.

 

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>