简体   繁体   English

无法从本地服务器推送到GitLab存储库(钩子被拒绝了吗?)

[英]Can't push to GitLab repository from local server (hooks declined?)

I have a local Git repository on the same server as a GitLab repository. 我在与GitLab存储库相同的服务器上有一个本地Git存储库。 I could pull, but not push. 我可以拉,但不能推。 Since I am on the same server, I haven't bothered with SSH keys. 由于我在同一台服务器上,因此我不必担心SSH密钥。 Looking at GitLab's hooks tab, nothing is shown (Note that I have never used hooks, and really don't yet know their purpose). 查看GitLab的hooks选项卡,没有显示任何内容(请注意,我从未使用过hooks,实际上还不知道它们的用途)。 How is this resolved? 如何解决? Thank you 谢谢

[root@vps bidjunction]# git remote -v
origin  /home/git/repositories/root/bidjunction.git (fetch)
origin  /home/git/repositories/root/bidjunction.git (push)

[root@vps bidjunction]# git push origin master
Counting objects: 25, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (14/14), done.
Writing objects: 100% (14/14), 2.31 KiB | 0 bytes/s, done.
Total 14 (delta 11), reused 0 (delta 0)
remote: GitLab: You are not allowed to access master!
remote: error: hook declined to update refs/heads/master
To /home/git/repositories/root/bidjunction.git
 ! [remote rejected] master -> master (hook declined)
error: failed to push some refs to '/home/git/repositories/root/bidjunction.git'
[root@vps bidjunction]#

It can depend on the version of GitLab used: 它可能取决于所使用的GitLab版本:

That hook seems to be active by error after GitLab 6.7.x: see issue 6810 . 在GitLab 6.7.x之后,该挂钩似乎由于错误而处于活动状态:请参阅问题6810

After the upgrade, pushes to all repos started getting rejected with the following error message: 升级后,推送到所有存储库的操作开始被拒绝,并显示以下错误消息:

remote: GitLab: You are not allowed to access master!
remote: error: hook declined to update refs/heads/master

Downgrading back to 6.6.5 (and GitLab Shell 1.8.0) resolved the issue. 降级到6.6.5(和GitLab Shell 1.8.0)解决了该问题。

Note that it also mentions: 请注意,它还提到:

The resolution is to update the ldap section of gitlab.yml, wrapping all values currently wrapped in single quotes in double quotes instead. 解决方法是更新gitlab.yml的ldap部分,将当前用单引号引起来的所有值都用双引号引起来。

Seems that only those using LDAP for auth are affected. 似乎只有那些使用LDAP进行身份验证的用户受到影响。


It could be also because the master branch is protected, as mentioned in issue 6968 : 也可能是因为master分支受到保护,如问题6968中所述

if I make master a protected branch, I can't push to it even though I am the owner of the project (see error below). 如果我将master设为受保护的分支,即使我是该项目的所有者,也无法推送到它(请参见下面的错误)。
If I unprotect the master , then my push abilities are back. 如果我取消对master保护,那么我的推动能力就会恢复。

I am on GitLab 6.8.2. 我使用的是GitLab 6.8.2。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM