Get repository file of Gitlab in Ubuntu

Hello every one, please help me to get repository file directory of Gitlab in Ubuntu.

I’m just a fresher when using the Gitlab. I don’t have much experience.
I installed Gitlab on Ubuntu 18.04 and now i want to get all repository file directory to check and ensure the repository file was save on Ubuntu Server. but i don’t know and i can’t see any repository file, i have tried find with /var/opt/gitlab/git-data/… but when i open file .git and i not sure i can see anything.
I compared between SVN Server and Gitlab, With SVN Server i can see the data can save on Server and with Gitlab i can’t see it.
Please help me to find out the location of repository file.

Thank everyone

Hi,

to better understand your concern - why would you need access to the repository files on disk? Backups or something else? In case of existence, I’d recommend checking against the GitLab REST API to see if everything is there, or to go with a git clone by yourself.

Cheers,
Michael

Are you looking for /var/opt/gitlab/git-data/repositories?

But as @dnsmichi says: why are you looking for that? You’re almost certainly doing something wrong if you need to access that.

Thank @grove and @dnsmich for answer my question.

The reason i want to access that, because i want to ensure for everything if happen,and i can back up normally.
The requirement for engineer systems must troubleshoot all. And i just a fresher about Git lab and i need more experience from the people has more experience using Git Lab,

Thank all

In this specific regard, I’d suggest using the REST API. You can also integrate this into your monitoring tool(s) and scripts, e.g. with check_gitlab.

Cheers,
Michael

Thank @dnsmichi,
After research as your suggestion, i see some problems too hard to understand, can you explain it for me?

  1. How impact if i do missed something wrong? Because i see i have to much command line to get repositories and i just a little experience with it…
  2. And if i can get repositories in this server, i just need copy into from another server Git lab will start normal right?

Thank @Mr.dnsmichi.

Hi,

with using a REST API auth token, you can limit its permissions and create a read-only user. That way you cannot “break” things.

If you prefer to check via git clone https://... you may also use the cloned repository to push it into another remote repository, or use that local repository for backups if you prefer.

I’d say you’ll try it out by yourself. That helps with understanding what it does :slight_smile:

Cheers,
Michael

Hi @dnsmichi,

Thank for your explain.
I will try to configure this, and if i have any question, i hope i can receive the respond from you.

Thank @Mr.dnsmichi.

Hi Mr @dnsmichi,

I checked and i see 3 ways to clone repository :

  1. @hashed/6b/86/6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b.git
  2. git@mydomain:haonk/freecad.git ( used : SSH)
  3. http://mydomain/haonk/freecad.git ( use : HTTPS)
    Can you let me know how to get the url in my server : example : … /var/opt/gitlab/git-data/repositories/6b/86/6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b.git

But i see in project ( that was opened by Web Interface) we have 3 branch, and nothing in repository in my server, please help me to find it and try to open.

Thank Mr. @dnsmichi.

Hi,

I honestly don’t know how to get the path on the server. That’s stored inside GitLab’s database, and maybe is exposed via the REST API. You might want to research that in the API docs yourself.

In terms of cloning the repo, this syncs the branches from the remote Git repository to your local disk.

Cheers,
Michael

Hi Mr, @dnsmichi,

Thank for your help.
And i think i have problems with structure of Git lab when i installed on Ubuntu, may i must research it by other way. However, i want to say thank you very much for supported me.

Cheers.
Thank @dnsmichi

On the GitLab servers I manage, the /var/opt/gitlab/git-data/repositories contains subdirectories for each user/group, that then each contains that user/group’s repositories named for the projects. Our servers are installed using the omnibus package.

The build artifacts though live in directories with names like what you show (long hexstrings, the first two replicated as two levels of directories). Somewhere further down the directory stack is the the job id, that I’ve been able to use to find out which project those huge artifacts that were accumulating belonged to, and now I’m maintaining a list of those ids and project names, but a better way to link those together would be really appreciated.

Hi @Mr.Grove,

I can understand, but also i want to know how to open this file, ex : I have many branches that i have created before, when i try to open branches file and nothing to show there,i want to try open this file to ensure if my gitlab server have some i can install another gitlab server and move folder into this . And if this way can not process or impossible to do, with your experience can you give me the best solution to back up after disaster.

Thank @grove.