1
votes

I am currently running GitLab Omnibus v7.1.0 (call it gitlab-a) on CentOS 6.5. I built a new GitLab server using CentOS 6.8 (gitlab-b, this will eventually be upgraded to the latest GitLab 8 version), installed GitLab Omnibus v7.1.0 via RPM package (gitlab-7.1.0_omnibus-1.el6.x86_64.rpm), ran a backup on the original server (gitlab-a) using the following command:

sudo gitlab-rake gitlab:backup:create

I secure copied the resulting backup tar file to the the "new" server (gitlab-b, in this case) and restored it:

bundle exec rake gitlab:backup:restore RAILS_ENV=production

I ran:

sudo gitlab-rake gitlab:check SANITIZE=true

It complained about permissions and missing satellites. I followed the direction given:

chmod -R ug+rwX,o-rwx /var/opt/gitlab/git-data/repositories
chmod -R ug-s /var/opt/gitlab/git-data/repositories
find /var/opt/gitlab/git-data/repositories -type d -print0 | sudo xargs -0 chmod g+s
sudo -u git -H bundle exec rake gitlab:satellites:create RAILS_ENV=production

I tested this new installation (gitlab-b) and am able to git clone and git pull without any issues. However, when I create a branch (call it test-123), make changes in the test-123 branch, then try to git push the test-123 branch (git push origin test-123), I receive the following error:

Counting objects: 5, done.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 331 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: GitLab: You are not allowed to access test-123!
remote: error: hook declined to update refs/heads/test-123
To [email protected]:project/repo.git
 ! [remote rejected] test-123 -> test-123 (hook declined)
error: failed to push some refs to '[email protected]:project/repo.git'

I also noticed that on the new gitlab-b server, the /var/opt/gitlab/git-data/repositories/project/repo.git/refs/heads directory is empty. I think this is part of the cause of the problem. I am not sure how to resolve.

I have googled most of the past two days and found numerous related issues and solutions; unfortunately, I have not been able to find a solution that resolves this issue. Any ideas or anything to get me in the right direction will be greatly appreciated! Thank you in advance for your time. Please let me know if any additional information is needed.

1
Did you check the security settings of the repo? Are there protected branches configured? And: can you try to manually create your branch in repo.git on the server (via git branch)?Andreas Wolf
Hello Andreas! Sorry for the delay my my reply. We do use security and protected branches. These settings match the gitlab-a repo. I set this project to internal and public but still could not push. The same error is returned. I am the owner of the project. I also manually created the repo.git on the server and tried to push - same error. Thank you for your time and assistance. I sincerely appreciate it.SteveT

1 Answers

2
votes

In case anyone comes across this and has seemingly exhausted all the other good suggestions, check if there is a symlink anywhere under /opt/gitlab linking to another directory. In my case, I symlinked the default git_data_dir /opt/gitlab/git-data to /home/gitlab/opt/gitlab/git-data because the /home partition had the most disk space.

The correct way to handle this is NOT using a symlink but by editing /etc/gitlab/gitlab.rb, adding the line:

git_data_dir "/home/gitlab/opt/gitlab/git-data"

and running a gitlab reconfigure:

sudo gitlab-ctl reconfigure

References: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/configuration.md#storing-git-data-in-an-alternative-directory

https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-config-template/gitlab.rb.template#L215-219

Many sincerest thanks to those who took the time to help, comment, and/or read. Your time is greatly appreciated!

Best regards!