0
votes

Attempted to push local repository to GitLab and got the following error:

Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 220 bytes | 73.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: /opt/gitlab/embedded/service/gitlab-shell/lib/gitlab_net.rb:153:in `parse_who': undefined method `start_with?' for nil:NilClass (NoMethodError)
remote:         from /opt/gitlab/embedded/service/gitlab-shell/lib/gitlab_net.rb:31:in `check_access'
remote:         from /opt/gitlab/embedded/service/gitlab-shell/lib/gitlab_access.rb:27:in `block in exec'
remote:         from /opt/gitlab/embedded/service/gitlab-shell/lib/gitlab_metrics.rb:50:in `measure'
remote:         from /opt/gitlab/embedded/service/gitlab-shell/lib/gitlab_access.rb:26:in `exec'
remote:         from hooks/pre-receive:30:in `<main>'
To <my_gitlab_server>:<path_to_repo>
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@<my_gitlab_server>:<path_to_repo>'

Using GitLab Community Edition version 11.4.0 installed on a Linux server and Git Bash version 2.19.1 64-bit for Windows.

I created an empty project in the GitLab UI, cloned this to a local repository and attempted a push from the local repository to this project, for which I have Maintainer status.

The pre-receive hook being called here is the default one placed by GitLab, not the one in the local repository (since it is .sample).

1

1 Answers

0
votes

I have been getting the exact same error. So what I have just done is:

Accessed the gitlab server:

cd /opt/gitlab/embedded/service/gitlab-shell/hooks

mv pre-receive pre-receive-old

And I was able to push to my repository.

Why this happened and what exactly the file was blocking, beats me.