Errno :: EACCES:通过gitlab安装gem时权限被拒绝

Ale*_*lex 11 ruby gem bundle bundler gitlab

我正在尝试设置gitlab,从而使用sudo从另一个用户帐户安装一些宝石,但我经常遇到Permission denied错误.

sudo -u gitlab -H bundle install --deployment --without development test postgres

> Using ... ( a lot of successful gems there )
> Using pygments.rb (0.3.2) from https://github.com/gitlabhq/pygments.rb.git (at master) 
> Errno::EACCES: Permission denied - pygments.rb-0.3.2.gem
> An error occurred while installing pygments.rb (0.3.2), and Bundler cannot continue.
> Make sure that `gem install pygments.rb -v '0.3.2'` succeeds before bundling.\



sudo -u gitlab -H gem install pygments.rb -v '0.3.2'

> Successfully installed pygments.rb-0.3.2
> 1 gem installed
> Installing ri documentation for pygments.rb-0.3.2...
> Installing RDoc documentation for pygments.rb-0.3.2...
# no matter how many times I run this command, I always get the same output
# as if the gem installation doesn't stick 


# I've tried to chmod
chmod 777 -R /usr/local/lib/ruby



# then Again
sudo -u gitlab -H bundle install --deployment --without development test postgres
# same result, Errno::EACCES: Permission denied - pygments.rb-0.3.2.gem
Run Code Online (Sandbox Code Playgroud)

Ale*_*lex 15

Lain建议尝试将软件包安装到另一个子目录中.当问题解决后,很明显问题出在当前目录中的权限上.

执行chown -R gitlab:gitlab .已经解决了问题.

在gitlab安装指南中,在gem install我们的故事之前有一个以root身份运行的命令,可能该gemfile文件或其他文件在此期间有权限更改.

  • 永远不要更改所有目录和子目录中的所有权限或所有者,除非您确实知道更改的内容. (4认同)

小智 9

这是带有安装包的ruby-2.0.0-p195 rvm中的权限错误

你在用rvm吗?你用sudo尝试chmod吗?

chmod 755 (or 777) ~/.rvm/gems/ruby-2.0.0-p195/build_info/