I want to read my codes in the repositories folder

I installed Gitlab in the NAS server.

NAS server was out of control, but fortunately, I copied the repository folders to my pc before it was gone.

How could I read codes in the folders?

The project was a team work, so a couple of people participated in.

Should I know the usernames and passwords?

Thanks

What folder did you copy?

The folder it wold make sense to copy (on an omnibus installation) is /var/opt/gitlab/git-data/repositories/\@hashed, but manually reading anything from that is hard. First you’ll need to calculate the hash of the project to find the right subdirectory - it’s probably described how GitLab hashes (group/)project-names, but I’ve never cared enough to find it. Secondly, what’s there are “bare” git repositories, not anything meant for human readability.

You (probably) won’t need the usernames/passwords for anything.

What you did was not a good way to rescue data. I’ve never done anything like it, but you might be able to into a git repository (I think GitLab would complicate things here, and I don’t know if it had anything in it’s database that you’ll be missing, but it might help with the hashing) and checking it out. If you don’t use any options to suppress it, I believe that should give you the complete history in your local copy, which you can then submit to a new GitLab (the complete history should be submitted automatically unless you suppress it). It would probably have been a lot easier if you had a recent backup of GitLab - without knowing what “out of control” means it’s hard to say if it was possible, but taking a backup instead of copying dirs would have been preferable.

i copied gitlab folders like /gitlab/backups, builds, repositories, shared, ssh, tmp, uploads to my PC.

Please give us full paths. I have no idea what directories you’re talking about.

In the NAS, i copied gitlab folder.
Now i cannot access to the NAS, i can not check again.
The folder i have now, gitlab folder has backups, builds, repositories, shared, ssh, tmp, uploads folders.
In the repositories folder, i could check the project names, but i do not know how to read project codes.
Thanks.

What GitLab folder? Why didn’t you give full paths?

How did you install GitLab on your NAS?

How did you access the NAS when copying files?

On the GitLab servers I administrate there are no folders called backups that are next to folders called anything else of what you say, so what you say you have is quite puzzling.

What is your overall goal or next-step here? I think @grove’s gone over the options available to you, but I’ll repeat some of them as choices:

If you need to stand up a new GitLab instance, then you can check if the backups directory you’ve salvaged carry any recent backups and perform a direct restore on a new installation. The backup carries your former database data in it, so without one you may not be able to easily create a restored instance.

If you’re merely looking to extract or to check the git repository information, you’ll need to clone each of their storage directories into working copies (as @grove mentioned, they are in a bare form in your copy of the git server’s directory):

~> mkdir /tmp/working-copies/
~> cd /tmp/working-copies/
~> git clone file:///path/to/copied/repositories/group/project.git project-working-copy
~> cd project-working-copy/
~> ls

Note: You’ve mentioned that you’re able to see the project structure under the repositories directory, so I assume you were still on a GitLab version that used legacy storage. The new versions use a hashed path storage which will carry undecipherable paths that’s difficult to map to a nicer project and group name without the database backup available. You can still perform the above steps on their .git directories, but you’ll need to use git log and other commands to manually work out which project they may have belonged to.