Can';t从本地服务器推送到GitLab存储库(拒绝了钩子?)
我在与GitLab存储库相同的服务器上有一个本地Git存储库。我可以拉,但不能推。因为我在同一台服务器上,所以我不必担心SSH密钥。查看GitLab的hooks选项卡,没有显示任何内容(请注意,我从未使用过hooks,而且还不知道它们的用途)。这是如何解决的?多谢各位Can';t从本地服务器推送到GitLab存储库(拒绝了钩子?),git,gitlab,Git,Gitlab,我在与GitLab存储库相同的服务器上有一个本地Git存储库。我可以拉,但不能推。因为我在同一台服务器上,所以我不必担心SSH密钥。查看GitLab的hooks选项卡,没有显示任何内容(请注意,我从未使用过hooks,而且还不知道它们的用途)。这是如何解决的?多谢各位 [root@vps bidjunction]# git remote -v origin /home/git/repositories/root/bidjunction.git (fetch) origin /home/git
[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]#
它可能取决于所使用的GitLab版本: 在GitLab 6.7.x之后,该钩子似乎由于错误而处于活动状态:请参阅 升级后,对所有回购的推送开始被拒绝,并显示以下错误消息: 降级回6.6.5(和GitLab Shell 1.8.0)解决了这个问题 请注意,它还提到: 解决方案是更新gitlab.yml的ldap部分,将当前用单引号括起来的所有值改为用双引号括起来 似乎只有那些使用LDAP进行身份验证的人受到影响
这也可能是因为
主分支受到保护,如中所述:
如果我使master
成为受保护的分支,即使我是项目的所有者,我也无法推送到它(请参见下面的错误)。
如果我取消对主机的保护
,则我的推送能力将恢复
我使用的是GitLab 6.8.2
谢谢你,沃克。我将GitLab 6.81与shell 1.9.3一起使用,因此这可能是问题的一部分。但是,我可以从我的Linux开发服务器推到它,它不在另一台服务器附近。我想这可能与主机受到保护有更大关系,但话说回来,为什么另一台机器可以推送它?@user1032531是您使用不同的用户帐户从Linux dev服务器推送的吗?或者是一个不同的url(http/ssh/…),正如GitRemote-v所看到的,它根本没有使用url,而是使用一个直接路径。另外,Linuxdev服务器使用用户“git”,而另一台服务器使用我当时登录的任何用户名(自从我设置该用户以阻止shell访问以来,该用户名从来都不是用户“git”)。我误解了你的问题吗?@user1032531“我误解了你的问题吗?”:不,这就解释了行为上的差异:用户git
可以访问master
分支,其他帐户不能。不知道为什么(这可能与我在回答中提到的6968问题有关)。你认为最好的解决方案就是允许用户git访问shell,并以这种方式推送?
remote: GitLab: You are not allowed to access master!
remote: error: hook declined to update refs/heads/master