First of all I really love gitlab. It’s free, open-source and it’s a great tool to manage your repositories. But for some reason it’s also very fragile. Atleast my setup fails now and then because I updated my system or updated gitlab or for some other unknown reason. In this article I discuss my issues and solutions. Feel free to comment or post your own issue.
Gitlab.com Service
Let me start with a tip! If you don’t like to host your own gitlab because you get tired of all the issues and fixing or because your server is too slow to manage all your repositories then there is good news. Gitlab offers a totally free service, unlimited (private) repositories and unlimited disk space (max 1 gb per repository). That sounds good right! More info can be found here: https://about.gitlab.com/gitlab-com/
Issue #1: Cannot push to remote, hook declined
Let’s start with my first issue. First let me give you some background info. I run gitlab inside a VM that runs on Windows Server. My repositories are located on a NTFS formatted harddisk under Windows Server that I share with my VM. As VM I use VirtualBox. Now everything was setup perfectly and working correctly but after a while I got this error:
1 2 3 4 5 6 7 8 9 10 11 |
Counting objects: 26, done. Delta compression using up to 8 threads. Compressing objects: 100% (19/19), done. Writing objects: 100% (21/21), 7.11 KiB | 0 bytes/s, done. Total 21 (delta 7), reused 0 (delta 0) remote: hooks/update:11:in `require_relative': cannot load such file -- /mnt/data/git/repositories/localhistory/website.git/lib/gitlab_update (LoadError) remote: from hooks/update:11:in `<main>' remote: error: hook declined to update refs/heads/master To git@gitlab.noveesoft.com:localhistory/website.git ! [remote rejected] master -> master (hook declined) error: failed to push some refs to 'git@gitlab.noveesoft.com:localhistory/website.git' |
I navigated to my repository directory and found out that my hooks directory wasn’t a symlink anymore. So I deleted the current hooks directory and re-created the symlink:
1 |
ln -s /opt/gitlab/embedded/service/gitlab-shell/hooks/ hooks |
Unfortunality this resulted in an error:
1 |
ln: failed to create symbolic link `hooks': Read-only file system |
The error was caused by my VM. So it had nothing to do with gitlab but it did affect gitlab. I fixed it by going on my Windows Server machine to the directory were VirtualBox was installed. I closed my VM and run this command from the command-line:
1 |
VBoxManage setextradata VM_NAME VBoxInternal2/SharedFoldersEnableSymlinksCreate/SHARE_NAME 1 |
Now restart your VM and create the symbolic links and try to push again. It should work now.