Migrate data from dead Gitlab-CE instance using only local files, backup corrupted!

Tried this but the past repos and other bits weren’t showing up in the new instance. I could create a new repo and it would show up in the “@hashed” directory next to all the ones I want to restore, but only the new ones were recognized it seems…

I did find a fix that works well enough though! I misconstrued that “hashed” repos meant that the project files themselves were put through a hash and unrecoverable without a key. In reality hashing is the technique used to organize the projects in the repos directory. So really, all the bare repos were just hidden behind several scarily named folders.

For anyone trying to recover repos from local git files, you can:

  • go to /repositories/@hashed
  • cd into “<hash num>/<longer hash num>/<huge hash.git>”. This is a bare git repository that was on your server
  • git remote add origin “<new remote project url>”
  • git push --all origin

And that repo should be up on that new project. It isn’t ideal because I’ve lost everything else related to the server but at least my repos are safe.

4 Likes