'git repository location on gitlab server is missing data
Gitlab server has a empty repository though i have couple of project pushed onto the gitlab url
I have created a gitlab server, using docker-compose file. The git lab is setup successfully, i logged into the console, created a new group, then new project and then pushed a sample docs into the new repository.
I can see the data from gitlab console at the navigation:
http://<URL>:8888/devops-group/maven/tree/master
However, when i login to the server and i go to the below path i do not see any data:
root@gitlab:/var/opt/gitlab/git-data/repositories# pwd
/var/opt/gitlab/git-data/repositories
root@gitlab:/var/opt/gitlab/git-data/repositories# ls -ltr
total 0
drwxr-s---. 3 git root 16 Aug 15 02:36 @hashed
root@gitlab:/var/opt/gitlab/git-data/repositories#
while creation of gitlab using docker-compose i have used below code
volumes:
- '/srv/gitlab/config:/etc/gitlab'
- '/srv/gitlab/logs:/var/log/gitlab'
- '/srv/gitlab/data:/var/opt/gitlab'
Whatever the projects or code i have pushed onto the repository, I should be able to see them on the server. Also i need to create git hooks therefore i need this path location on the gitlab server. Please help me to find the repository location for my projects on the server.
Solution 1:[1]
Check first your gitlab.rb configuration file in /srv/gitlab/config (on your server).
A default one would include a storage set to /home/git/repositories/.
If that path does not start with /srv/gitlab/data, that would explain why nothing is mapped to /var/opt/gitlab.
Check "Run the image"
The idea behind those volume definitions is to store and persists data on the Docker host. Make sure the folder /src/gitlab/xxx exist and are writable.
Solution 2:[2]
try running this command in your git container. this should resolve your problem.
gitlab-rake gitlab:storage:rollback_to_legacy ID_FROM=1 ID_TO=50
Solution 3:[3]
I also encountered same issue and here is how I figured it out and ran git hook successfully:
Answer to part-I of your query(Please help me to find the repository location for my projects on the server):
Gitlab supports following repository storage types- https://docs.gitlab.com/ee/administration/repository_storage_types.html
From GitLab 10.0 onwards git lab supports hashed storage for repository and in GitLab13.0, legacy repository storage is deprecated.
In hashed storage we can find the location of repository as mentioned in this link: https://docs.gitlab.com/ee/administration/repository_storage_types.html#from-project-name-to-hashed-path
- Find Gitaly relative path from gitlab web ui(Menu >> admin >> Projects >> select/click on your project >> copy the value of "Gitaly relative path:")
For ex: @hashed/9f/14/9f14025af0065b30e47e23ebb3b491d39ae8ed17d33739e5ff3827ffb3634953.git
This hashed path can also be found using rails console as mentioned in above shared 2nd link.
- Your Git repository location would be "/var/opt/gitlab/git-data/repositories/Gitaly relative path"
For ex: /var/opt/gitlab/git-data/repositories/@hashed/9f/14/9f14025af0065b30e47e23ebb3b491d39ae8ed17d33739e5ff3827ffb3634953.git
Answer to part-II of your query( Also i need to create git hooks therefore i need this path location on the gitlab server):
The dir found in above step 2 is the git repository directory where you can create custom_hooks dir and place your git hooks into it.
https://docs.gitlab.com/ee/administration/server_hooks.html
Note: In order to run the hook successfully, please ensure that you provide proper permission to custom_hook dir/hooks as well as the ownership to the required user.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | iknow |
| Solution 3 | Mithun |
