gitlab-rake assets:预编译RAILS_ENV =生产失败,出现权限错误

Sho*_*ita 3 gitlab

我在CentOS 7上安装了GitLab 7.7.2并成功安装.

现在我尝试以子目录样式运行GitLab,例如http:// url/gitlab.

我查看了这个文件,并按照此说明进行了更改./选择/ gitlab /嵌入式/服务/ gitlab护栏/配置

然后我预编译并得到错误.

# gitlab-rake assets:precompile RAILS_ENV=production
I, [2015-02-27T17:35:18.980208 #4864]  INFO -- : Writing /opt/gitlab/embedded/service/gitlab-rails/public/assets/authbuttons/github_32-199ebcd7adccbfe20068d39bfd57e6bf.png
rake aborted!
Errno::EACCES: Permission denied @ rb_sysopen - /opt/gitlab/embedded/service/gitlab-rails/public/assets/authbuttons/github_32-199ebcd7adccbfe20068d39bfd57e6bf.png+

Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
Run Code Online (Sandbox Code Playgroud)

我该怎么办?

cfi*_*cfi 6

这篇文章描述了一个很好的解决方法 与用户Perceval FARAMAZ建议的类似,我们可以临时打开权限以编译新资产和已更改资产,然后再将其关闭.

通过使用ACL而不是标准位,这仅针对git用户,而不实际更改所有权root:root:

# ... hack on CSS ...

# Need to let user `git` write to assets/ because gitlab-rake tries to write
# to it as `git`, while `assets/` is owned by root.
apt-get install acl
setfacl -R -m u:git:rwX /opt/gitlab/embedded/service/gitlab-rails/public/assets/
gitlab-rake assets:precompile RAILS_ENV=production
chmod -R a+rX /opt/gitlab/embedded/service/gitlab-rails/public/assets/

# Remove git's write access
setfacl -R -x u:git /opt
Run Code Online (Sandbox Code Playgroud)

这适用于添加新图像以及更改现有资产.