0

I have GitLab CE, but install is damaged and i can't start it. How i can download and open all repositories from file system?

UPDATE:

In gitlab.rb i have git repositories path and it is: /var/opt/gitlab/git-data/repositories/, but there is what i've found:

FETCH_HEAD
HEAD
config
description
hooks -> /opt/gitlab/embedded/service/gitlab-shell/hooks
hooks.old.1478620628
info
objects
refs

But there are no usual repository with source codes.

dikkini
  • 1,184
  • 1
  • 23
  • 52
  • It’s configurable where the repositories are stored. See [this documentation](https://docs.gitlab.com/ce/administration/repository_storage_paths.html). You should check what you have configured, and then go there. There should be a file structure of hopefully normal GIt repositories there (I don’t have GitLab, so I don’t know if that’s the case). – poke Mar 24 '17 at 08:30
  • This looks like a repository. Have you actually tried to `find` your repositories? – Fairy Mar 24 '17 at 09:55
  • Gitlab will store *bare* repositories, and this looks exactly like one. A bare repository will just hold the content of the `.git/` folder, and will not have a checkout of your code. – LeGEC Mar 24 '17 at 09:59
  • So, where i can find real repository in case when my gitlab is broken? – dikkini Mar 24 '17 at 10:01

1 Answers1

5

This is a bare repository (you can see a pretty clear description in this SO question).

It does not contain a checkout copy of your code, but you can use it as a regular target for git clone, git fetch / pull, and git push :

  • If it is on the same computer as your working computer, you can clone it to a regular repository :

    # in your development directory :
    $ git clone /var/opt/gitlab/git-data/repositories/<project-dir>
    
  • If it lies on a computer which you can access through ssh, you can clone it through ssh :

    $ git clone user@server:/var/opt/gitlab/git-data/repositories/<project-dir>
    
  • If your gitlab is down, and no other user can possibly modify this repo, it is safe to simply copy the directory, or make a tar archive :

    $ cd /var/opt/gitlab/git-data/repositories/
    $ tar -czf project.tgz project-dir/
    
    # then copy this tar archive anywhere you want,
    # extract it, and use it as above
    

Any of the above will also give you a backup of your current repo, which you can use to restore your gitlab afterwards.

LeGEC
  • 46,477
  • 5
  • 57
  • 104
  • 1
    This is still relevant in GitLab CE 14.x, the only difference is that the raw git repos are stored in `/var/opt/gitlab/git-data/repositories/@hashed/##/##/##.git`. I was able to clone the `.git` directory directly. – Andacious Apr 05 '22 at 01:52