无法从本地服务器推送到GitLab存储库(挂钩拒绝?) [英] Can't push to GitLab repository from local server (hooks declined?)

查看:486
本文介绍了无法从本地服务器推送到GitLab存储库(挂钩拒绝?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在GitLab存储库的同一台服务器上有一个本地Git存储库。我可以拉,但不能推。由于我在同一台服务器上,所以我没有为SSH密钥烦恼。查看GitLab的钩子标签,没有显示任何东西(请注意,我从来没有使用过钩子,但实际上还不知道它们的用途)。这是如何解决的?谢谢

  [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
计数对象:25,完成。
使用多达8个线程的增量压缩。
压缩对象:100%(14/14),完成。
写作对象:100%(14/14),2.31 KiB | 0字节/秒,完成。
总计14(德尔塔11),重用0(德尔塔0)
远程:GitLab:您不允许访问主!
remote:error:hook拒绝更新refs / heads / master
到/home/git/repositories/root/bidjunction.git
! [remote rejected] master - > master(钩子已拒绝)
错误:无法将某些参考推送到'/home/git/repositories/root/bidjunction.git'
[root @ vps bidjunction]#

解决方案

它可以取决于所使用的GitLab的版本:



在GitLab 6.7.x之后,该钩子似乎被错误激活:请参阅 issue 6810
$ b


升级后,推送到所有回购站开始遭到拒绝,并显示以下错误消息:




  remote:GitLab:您不允许访问master! 
remote:error:hook拒绝更新refs / heads / master




降级到6.6.5(和GitLab Shell 1.8.0)解决了这个问题。


请注意,它还提到:


解决方法是更新gitlab.yml的ldap部分,将所有当前包裹在单引号中的值用双引号括起来。



似乎只有那些使用LDAP进行身份验证的用户才会受到影响。







也可能是因为 master 分支受到保护,如>
$ b

master $ 受保护的分支,即使我是项目的所有者,我也无法推送它(请参阅下面的错误)。

如果我取消保护主人,那么我的推送能力就回来了。



我在GitLab 6.8.2上。



I have a local Git repository on the same server as a GitLab repository. I could pull, but not push. Since I am on the same server, I haven't bothered with SSH keys. Looking at GitLab's hooks tab, nothing is shown (Note that I have never used hooks, and really don't yet know their purpose). 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:

That hook seems to be active by error after GitLab 6.7.x: see issue 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.

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.

Seems that only those using LDAP for auth are affected.


It could be also because the master branch is protected, as mentioned in issue 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).
If I unprotect the master, then my push abilities are back.

I am on GitLab 6.8.2.

这篇关于无法从本地服务器推送到GitLab存储库(挂钩拒绝?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆