Pre-receive hook fails with gitlab-omnibus if /var/opt is a symlink
Created by: FooBarWidget
We have a rather unique server setup where /var/opt is symlinked to /home/system/var_opt. The reason why we do this is because the server is partially encrypted. The base system is unencrypted, and most of the actual data lives in the encrypted partition. /opt and /var/opt are thus symlinked to directories within the encrypted partition.
However this causes gitlab-omnibus's pre-receive hook to fail. In the pre-receive hook, repo_path
evaluates to /home/system/var_opt/gitlab/git-data/repositories/...
-- the expanded version of the path. This causes GitlabAccess.new(repo_path, key_id, refs).exec
to fail. Whatever command it executes, it outputs:
GitLab: No such project
We solved this problem locally by adding the following line to the pre-release hook which fixes up the path:
# In /opt/gitlab/embedded/service/gitlab-shell/hooks/pre-receive:
repo_path.sub!("/home/system/var_opt/", "/var/opt/")