newline added to repo path in update hook (hook declined to update [...])
Created by: FewKinG
I installed gitlab manually (not the package) and everything seemed to work fine at first, but whenever I tried to push a branch to my remote origin it failed giving the following error message:
remote: GitLab: You are not allowed to access [...]!
remote: error: hook declined to update [...]
After some research I found that the problem occurs in /home/git/gitlab-shell/hooks/update where the repo path is determined by
repo_path = `pwd`
However, for me (using Ubuntu 14.04 and Ruby 2.1.2p95) this results in the repo_path having a trailing newline in it. This newline is also kept in the api call which determines if the user is allowed access to that repository. The API thus fails to find the repository, returning false, which will result in the error given above.
The solution for me was to change the line in the update hook to
repo_path = `pwd`.strip
Now everythings working fine. Anybody else ever had that problem?