第四步,让gitlab-shell访问本地gitlab server的REST API时禁止启用SSL证书
参考这个帖子:https://github.com/gitlabhq/gitlabhq/issues/3292
so i had to add string not to check certificate at /home/git/gitlab-shell/lib/gitlab_net.rb
from:
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = (url.port == 443)
request = Net::HTTP::Get.new(url.request_uri)
http.start {|http| http.request(request) }
to:
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = (url.port == 443)
http.verify_mode = OpenSSL::SSL::VERIFY_NONE if http.use_ssl?
request = Net::HTTP::Get.new(url.request_uri)
http.start {|http| http.request(request) }
我这里不交代如何在Nginx中设置SSL证书。
第五步,Nginx中的gitlab配置, 也许对大家有用,仅供参考:
File Edit Options Buffers Tools Help
# GITLAB
# Maintainer: @randx
# App Version: 4.0
upstream gitlab {
server unix:/home/git/gitlab/tmp/sockets/gitlab.socket;
}
server {
listen *:443; # e.g., listen 192.168.1.1:80;
ssl on;
ssl_certificate /etc/nginx/sites-available/server.crt;
ssl_certificate_key /etc/nginx/sites-available/server.key;
server_name localhost;
#Ubuntu1204-dell source.myserver.com; # e.g., server_name source.example.com;
root /home/git/gitlab/public;
# individual nginx logs for this gitlab vhost
access_log /var/log/nginx/gitlab_access.log;
error_log /var/log/nginx/gitlab_error.log;
location / {
# serve static files from defined root folder;.
# @gitlab is a named location for the upstream fallback, see below
try_files $uri $uri/index.html $uri.html @gitlab;
}
# if a file, which is not found in the root folder is requested,
# then the proxy pass the request to the upsteam (gitlab unicorn)
location @gitlab {
proxy_read_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
proxy_connect_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
proxy_redirect off;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://gitlab;
}
}
这样才能让
sudo -u git -H /home/git/gitlab-shell/bin/check
和
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
检查全部通过。
并且才能解决客户端git clone 不能访问的问题。
GitLab 的详细介绍:请点这里
GitLab 的下载地址:请点这里
