推送至GitLab :! [远程拒绝]主机->主机(预接收挂钩被拒绝)

时间:2018-11-08 14:37:44

标签: repository gitlab push hook git-bash

试图将本地存储库推送到GitLab并出现以下错误:

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>'

使用Linux服务器上安装的GitLab社区版本11.4.0和Windows的Git Bash版本2.19.1(64位)。

我在GitLab UI中创建了一个空项目,将其克隆到本地存储库,并尝试从本地存储库推送到该项目,该项目具有我的维护者身份。

此处调用的预接收钩子是GitLab放置的默认钩子,而不是本地存储库中的钩子(因为它是.sample)。

1 个答案:

答案 0 :(得分:0)

我一直得到完全相同的错误。所以我刚做的是:

访问了gitlab服务器:

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

mv预先接收pre-receive-old

我能够推送到我的存储库。

为什么会发生这种情况,以及文件到底被阻止了,所以打败了我。