自搭gitlab报错--git operation was rejected by pre-receive hook

在搭建并完成gitlab源码编译后,遇到提交失败的问题,错误提示为'git operation was rejected by pre-receive hook'。通过运行gitlab检查命令发现gitlab-shell存在问题。解决方案是修改/home/git/gitlab-shell/config.yml文件,确保GitLab和GitLab-Shell配置文件中的IP或域名一致,如有必要,包括端口号。问题解决后,git操作恢复正常。
摘要由CSDN通过智能技术生成
自己编译gitlab源码搭建中文版gitlab完成后突然无法提交,gitlab服务使用正常,可是新建库文件,gitclone的时候报错。用gitlab本身也报错。
报错git operation was rejected by pre-receive hook

[img]http://dl2.iteye.com/upload/attachment/0126/5745/b34393c4-00a6-3041-b73d-69a24b1c1f7f.png[/img]

无意间找到一个检测gitlab的是否完整的命令
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production

[img]http://dl2.iteye.com/upload/attachment/0126/5747/d71f8b04-cc37-360e-b1aa-a4da358d409a.png[/img]

GitLab Shell version >= 2.7.2 ? ... OK (2.7.2)
Repo base directory exists? ... yes
Repo base directory is a symlink? ... no
Repo base owned by git:git? ... yes
Repo base access is drwxrws---? ... yes
hooks directories in repos are links: ...
Administrator / tgrambaseline1.0 ... repository is empty
Administrator / testing ... ok
Running /home/git/gitlab-shell/bin/check
Check GitLab API access: FAILED. code: 404
gitlab-shell self-check failed
Try fixing it:
Make sure GitLab is running;
Check the gitlab-shell configuration file:
sudo -u git -H editor /home/git/gitlab-shell/config.yml
Please fix the error above and rerun the checks.


从日志可以看出 提示我 gitlab-shell有问题 让我改 /home/git/gitlab-shell/config.yml 文件

先查看一下这个文件
sudo -u git -H vi /home/git/gitlab-shell/config.yml

user: git
gitlab_url: http://xxx.xxx.xxx.xx/
http_settings:
self_signed_cert: false
repos_path: "/home/git/repositories/"
auth_file: "/home/git/.ssh/authorized_keys"
redis:
bin: "/usr/bin/redis-cli"
namespace: resque:gitlab
socket: "/var/run/redis/redis.sock"
log_level: INFO
audit_usernames: false


GitLab设置IP或者域名有两个配置文件:
1、GitLab的:/home/git/gitlab/config/gitlab.yml
2、GitLab-Shell的:/home/git/gitlab-shell/config.yml
把两个配置文件的IP或者域名修正过来即可。在GitLab-Shell的配置文件中,如果域名带端口号,也要把端口号写上。例如我的是gitlab_url: "http://gitlab.xxxx.xxxx.com:8088/"
加上端口号就好了。

[img]http://dl2.iteye.com/upload/attachment/0126/5757/0904152e-0a24-382e-804b-514cbe75b513.png[/img]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值