git Gitlab 推送。您无权访问 master

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23973185/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 18:09:02  来源:igfitidea点击:

Gitlab push. You are not allowed to access master

gitgitlab

提问by AuStrike

I have set up my own server (at home) and i am reaching it via putty on my main PC.

我已经设置了我自己的服务器(在家里),我正在通过我的主 PC 上的腻子访问它。

Gitlab is installed and configured, i can reach gitlab and log in. But when i try to push files (through HTTP) to my own project i get this message:

Gitlab 已安装和配置,我可以访问 gitlab 并登录。但是当我尝试将文件(通过 HTTP)推送到我自己的项目时,我收到以下消息:

POST git-receive-pack (381 bytes)
remote: GitLab: You are not allowed to access master![K
remote: error: hook declined to update refs/heads/master[K
To http://myserver.com/root/push2jump.git
 ! [remote rejected] master -> master (hook declined)
error: failed to push some refs to 'http://myserver.com/root/push2jump.git'

I am using HTTP instead of SSH because there i get "Access denied", so basically neither is working.

我使用 HTTP 而不是 SSH,因为我得到“拒绝访问”,所以基本上两者都不起作用。

When i run

当我跑

sudo bundle exec rake gitlab:check RAILS_ENV=production

It tells me that the Sidekiq script is not running (which i can't seem to fix, not sure if it's related to this problem) Ofcourse it tells me that the repository is empty. The rest seems fine.

它告诉我 Sidekiq 脚本没有运行(我似乎无法修复,不确定它是否与这个问题有关)当然它告诉我存储库是空的。其余的似乎还好。

I checked

我检查了

.ssh/authorized_keys

Which seem correct as well, the key there is the same as my saved key.

这似乎也正确,那里的密钥与我保存的密钥相同。

And my repos_path in gitlab-shell/config.yml looks good, not using symlink:

我在 gitlab-shell/config.yml 中的 repos_path 看起来不错,没有使用符号链接:

repos_path: /home/git/repositories/

I have run the official gitlab installation guide.

我已经运行了官方的 gitlab 安装指南。

Can anyone help me with this problem? Thanks in advance

谁能帮我解决这个问题?提前致谢

UPDATE

更新

System information
System:         Ubuntu 12.04
Current User:   git
Using RVM:      no
Ruby Version:   2.0.0p481
Gem Version:    2.0.14
Bundler Version:1.6.2
Rake Version:   10.3.1
Sidekiq Version:2.17.0

GitLab information
Version:        6.9.2
Revision:       e46b644
Directory:      /home/git/gitlab
DB Adapter:     mysql2
URL:            ***
HTTP Clone URL: ***/some-project.git
SSH Clone URL:  ***:some-project.git
Using LDAP:     no
Using Omniauth: no

GitLab Shell
Version:        1.9.4
Repositories:   /home/git/repositories/
Hooks:          /home/git/gitlab-shell/hooks/
Git:            /usr/local/bin/git

回答by Neil

I had this problem because I had masteras a protected branch

我有这个问题,因为我有master一个受保护的分支

Protect branch won't accept push

保护分支不会接受推送

Once I unprotected the branch I was able to push fine

一旦我取消了对分支的保护,我就可以很好地推动

回答by Phil Ryan

Kill it and start again with the Omnibus edition of Gitlab.

杀死它并使用 Gitlab 的 Omnibus 版本重新开始。

The only thing being that you need to run it on a 64-bit Ubuntu - not sure why they don't have a 32-bit, but there you are.

唯一的事情是你需要在 64 位 Ubuntu 上运行它 - 不知道为什么他们没有 32 位,但你在那里。

I had gone down the install-re-install-try-again hell until I just went with the Omnibus edition.

在我刚刚使用 Omnibus 版本之前,我已经经历了安装-重新安装-再试一次的地狱。

Two "annoying" things: the Omnibus install of Gitlab uses the Nginxweb server rather than Apache (but there is a good reason for that given that Nginx doesn't open a new process for every connection)... and it uses PostgreSQLrather than MySQL for its database. For home/home-office usage, of course you can have PostgreSQL and MySQL installed on the same machine. Less obvious is how to run Apache and Nginx, or really, how to get Nginx to run multiple virtual servers while still maintaining Gitlab.

两个“烦人”的事情:Gitlab 的 Omnibus 安装使用NginxWeb 服务器而不是 Apache(但有一个很好的理由,因为 Nginx 不会为每个连接打开一个新进程)......它使用PostgreSQL而不是比 MySQL 作为它的数据库。对于家庭/家庭办公室使用,当然您可以在同一台机器上安装 PostgreSQL 和 MySQL。不太明显的是如何运行 Apache 和 Nginx,或者说,如何让 Nginx 运行多个虚拟服务器,同时仍然维护 Gitlab。

回答by howanu

I had a very similar symptoms, and solved the problem through a change to Project membership. The error message I received from TurtoiseGit after a push attempt was:

我有一个非常相似的症状,并通过更改项目成员身份解决了问题。我在尝试推送后从 TurtoiseGit 收到的错误消息是:

git.exe push --progress "origin" master:master

Counting objects: 14, done. Delta compression using up to 4 threads. Compressing objects: 100% (7/7), done. Writing objects: 100% (8/8), 857 bytes | 0 bytes/s, done. Total 8 (delta 3), reused 0 (delta 0)

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

To [email protected]:datascience/compliance.git ! [remote rejected] master -> master (hook declined) error: failed to push some refs to '[email protected]:datascience/compliance.git'

git did not exit cleanly (exit code 1) (33181 ms @ 6/27/2014 9:50:32 AM)

git.exe push --progress "origin" master:master

计数对象:14,完成。Delta 压缩最多使用 4 个线程。压缩对象:100% (7/7),完成。写入对象:100% (8/8),857 字节 | 0 字节/秒,完成。总计 8 个(增量 3),重复使用 0 个(增量 0)

远程:GitLab:您无权访问 master!远程:错误:钩子拒绝更新 refs/heads/master

[email protected]:datascience/compliance.git ![远程拒绝] master -> master(钩拒绝)错误:未能将一些引用推送到“[email protected]:datascience/compliance.git”

git 没有完全退出(退出代码 1)(33181 毫秒 @ 6/27/2014 9:50:32 AM)

In the gitlab admin pages, I found that I was not a member of the project that I tried to push to. I was a member of the project's group, but not the project.

在 gitlab 管理页面中,我发现我不是我试图推送到的项目的成员。我是项目组的成员,但不是项目的成员。

After I added myself as a project member, my push succeeded without error.

将自己添加为项目成员后,我的推送成功无误。

回答by jdknight

Just had the You are not allowed to access master!error on a repository I owned. None of the protected branch settings had changed. The issue appeared to occur right after performing a backup of the GitLab server; possibly the server was in a bad state. After performing a check of my GitLab setup, I was able to push again:

刚刚在You are not allowed to access master!我拥有的存储库上出现错误。受保护的分支设置均未更改。该问题似乎是在执行 GitLab 服务器备份后立即发生的;可能是服务器状态不好。在检查了我的 GitLab 设置后,我能够再次推送:

gitlab-rake gitlab:check

GitLab's troubleshooting guide. Observed this issue on GitLab 7.4.3.

GitLab 的故障排除指南。在 GitLab 7.4.3 上观察到这个问题。



Initially I thought this was a protected branch issue. It seemed odd that I had lost access to a repository branch I was the owner of. After disabling the protection on the branch, a push still resulted in the same access issue. Restoring the protected branch left me in the same state. I performed the GitLab check (mentioned above) which appeared to resolve the issue.

最初我认为这是一个受保护的分支问题。我失去了对我拥有的存储库分支的访问权限,这似乎很奇怪。禁用分支上的保护后,推送仍然导致相同的访问问题。恢复受保护的分支让我处于相同的状态。我执行了 GitLab 检查(上面提到的),这似乎解决了这个问题。

回答by zhaozhi

in my case, it's because unicorn's port was occupied by another java process, add this line unicorn['port'] = 8090 to /etc/gitlab/gitlab.rb and run: sudo gitlab-ctl reconfigure

就我而言,这是因为 unicorn 的端口被另一个 java 进程占用,将这一行 unicorn['port'] = 8090 添加到 /etc/gitlab/gitlab.rb 并运行:sudo gitlab-ctl reconfigure