gitlab在项目下新建文件的时候报错:Commit was rejected by pre-receive hook
查看日志报错如下:
I, [2016-04-27T15:39:33.612103 #24808] INFO -- : Update head in project root/first.git to <master>.
W, [2016-04-27T16:40:43.040556 #3471] WARN -- : Failed to connect to internal API <POST https://172.18.84.17//api/v3/internal/allowed>: #<OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed>
看得出来是ssl证书的问题。
有两种解决方法,第一种就是关闭443启用80端口访问,修改gitlab的配置文件
/home/git/gitlab/config/gitlab.yml
gitlab:
## Web server settings (note: host is the FQDN, do not include http://)
host: 172.18.84.17
port: 80 # Set to 443 if using HTTPS, see installation.md#using-https for additional HTTPS configuration details
https: false # Set to true if using HTTPS, see installation.md#using-https for additional HTTPS configuration details
[[email protected] git]# cat /home/git/gitlab-shell/config.yml
---
user: git
gitlab_url: http://172.18.84.17/
http_settings:
self_signed_cert: true
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
修改nginx配置开启80端口,配置文件直接从官网下载:
https://gitlab.com/gitlab-org/gitlab-ce/raw/master/lib/support/nginx/gitlab
重启gitlab和nginx问题解决。第二种方法是依然使用https,只需要修改配置文件:
[[email protected] git]# cat /home/git/gitlab-shell/config.yml
---
user: git
gitlab_url: https://172.18.84.17/
http_settings:
self_signed_cert: true
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
标红处默认为false,修改为true之后重启gitlab即可。