如何让gitlab使用不同于git的用户



我正试图让gitlab与另一个用户一起运行,但我找不到任何配置它的地方。

我尝试这样做是因为我需要使用NIS帐户来运行它,事实上,我甚至删除了git本地用户,在NIS上创建了一个,并试图像这样重新启动它(在修复了由于UID和GID更改而导致的所有权之后)。

STDERR: usermod: user 'git' does not exist in /etc/passwd
---- End output of ["usermod", "-g", "10032", "-s", "/bin/sh", "git"] ----
Ran ["usermod", "-g", "10032", "-s", "/bin/sh", "git"] returned 6

完整日志:https://gist.github.com/ssbarnea/83b9c07678187dfe238f

git用户不在passwd文件中是一个NIS用户,这是非常正常的。此外,我无法找到gitlab从哪里获得用户组的10032值,为什么要重新配置它,或者我如何自定义或绕过它。

您首先需要创建一个不同的用户。

您可以在安装文档中替换以下所有实例:

  • sudo -u gitsudo -u yourNewUser
  • 用户git与正确的用户,如用/home/yourNewUser/替换/home/git/

同时检查配置文件config/gitlab.yml:

# Uncomment and customize if you can't use the default user to run GitLab (default: 'git')
# user: git

以下是此问题的错误报告,这是相对较新的活动:https://gitlab.com/gitlab-org/omnibus-gitlab/issues/737

我的解决方案是在/etc/gitlab/gitlab.rb中设置以下内容:

user['username'] = "git"
user['group'] = "git"
user['uid'] = 1040
user['gid'] = 1034
# # The shell for the git user
user['shell'] = "/bin/bash"
# # The home directory for the git user
user['home'] = "/var/home/git"

调整每个值以匹配您现有的NIS git用户。

然后运行gitlab ctl重新配置

重申对错误报告的一些评论。基本上,设置上面的值会让gitlab决定不需要创建任何用户。

最新更新