【发布时间】:2012-12-11 11:44:47
【问题描述】:
我正在尝试设置 gitlab,从而使用 sudo 从另一个用户帐户安装一些 gem,
但我不断收到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
【问题讨论】:
-
您是否尝试过
su - gitlab以该用户身份登录,然后运行命令以及何时完成注销?可能会更容易。 -
是的。我做到了。结果相同 (
Errno::EACCES: Permission denied - pygments.rb-0.3.2.gem) -
您可以尝试将项目本地目录用于 bin 和 gem 目录。我现在在我所有的项目上都这样做,例如
cd /home/gitlab/gitlab然后bundle install --binstubs --path vendor(作为 gitlab)和所有的 gem 进入 ./vendor,所有的 exe 进入 ./bin,相对于项目根目录。 -
嗯,它可以安装到
vendor子目录中。因此我猜最初的问题是当前目录的权限
标签: ruby gem bundle bundler gitlab