在 Gitlab 中配置相对 URL 不起作用

在 Gitlab 中配置相对 URL 不起作用

我已将 GitLab CE 配置为使用以下相对 URL本文档配置后运行重新配置时它给我一个错误。

步骤1

# cat /opt/gitlab/embedded/service/gitlab-rails/config/initializers/relative_url.rb

Rails.application.configure do
 config.relative_url_root = "/gitlab"
end

第2步

# cat /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml | grep relative_url
    relative_url_root: /gitlab

步骤3

# cat /opt/gitlab/embedded/service/gitlab-shell/config.yml | grep gitlab_url
gitlab_url: "http://localhost:8080/gitlab"

步骤4

# cat /opt/gitlab/embedded/service/gitlab-rails/config/unicorn.rb | grep  RAILS
ENV['RAILS_RELATIVE_URL_ROOT'] = "/gitlab"

步骤5

# cat /etc/gitlab/gitlab.rb | grep "auth_backend"
gitlab_workhorse['auth_backend'] = "http://localhost:8080/gitlab"

Step6 【发生错误的阶段】

# gitlab-ctl reconfigure
..
..
Running handlers:
There was an error running gitlab-ctl reconfigure:

link[/opt/gitlab/embedded/service/gitlab-rails/config/initializers/relative_url.rb] (gitlab::gitlab-rails line 342) had an error: TypeError: no implicit conversion of nil into String

Running handlers complete
Chef Client failed. 2 resources updated in 19 seconds

答案1

您似乎遇到了这个错误,标题为:没有将 nil 隐式转换为 String

该文件/etc/gitlab/gitlab.rb需要具有以下配置,git_data_dirs从以下格式更改:

git_data_dirs({
    "default": {
        "path": "/srv/gitlab/git-data"
    }
})

对此:

git_data_dirs({
    "default" => {
        "path" => "/srv/gitlab/git-data"
    }
})

然后重新运行重新配置:

$ gitlab-ctl reconfigure

参考

相关内容