Gitlab 推送。您无权访问 master

标签 git gitlab

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

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'

我使用的是 HTTP 而不是 SSH,因为在那里出现“访问被拒绝”,所以基本上两者都不起作用。

当我运行时

sudo bundle exec rake gitlab:check RAILS_ENV=production

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

我检查过

.ssh/authorized_keys

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

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

repos_path: /home/git/repositories/

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

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

更新

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

最佳答案

我遇到这个问题是因为我有 master 作为 protected 分支

Protect branch won't accept push

一旦我取消了对分支的保护,我就可以推送了

关于Gitlab 推送。您无权访问 master,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23973185/

相关文章:

git - 在 shell 上找到 git hooks 目录的路径

git - 保持 fork 最新的最有效方法

git - merge 前如何检查git状态?

git - `git bisect` 或 `git log -S --all` 找不到 merge 提交所做的更改

git - 克隆后记住多个 git 远程 url

gitlab - 如何在 gitlab 中创建存储库徽章?

python - 在 Docker 镜像中克隆 git 存储库失败

git - 在 GitLab Pipelines 中,有没有办法在分离 merge 请求时运行管道?

gitlab - 为什么 gitlab 在提交时运行重复的管道?

Gitlab 删除旧提交