安装宝石时不要求输入密码 [英] Stop asking for password when installing gems

查看:108
本文介绍了安装宝石时不要求输入密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


输入您的密码以将捆绑的RubyGems安装到您的密码中系统


这非常烦人,特别是在一个项目中捆绑多次时。但是,当我将gem目录设置为世界可读时,执行任何(!)rails命令时总会给我一个警告。当然,这更令人讨厌。



我该如何解决这个问题?

解决方案

绝对与系统ruby有关,而不是RVM,除非您使用Multi-User安装类型安装了RVM。如果你这样做了,并且仍然要求你输入密码,那么你安装了作为root 严格遵守列出的文档所述,并且你的普通用户没有被添加到安装程序创建的'rvm'组。 (注意:这是基于您希望多用户安装的想法,而不是单用户安装,如果您希望单用户安装,而不是在运行安装程序时安装了sudo,则不要使用 not 前缀。 )



取出RVM,然后重新注销(以确保全新重新初始化环境),然后像常规用户一样重新运行安装程序命令 ,而不是作为根,前缀为'sudo',如文档指示。



如果您不是安装了RVM,那么请按照 https://rvm.io 上的文档以单用户安装或多用户安装。在这种情况下,如果没有安装RVM,Billy Chan上面描述的是您的修复,但我会建议通过确定您需要运行哪一组精确的命令(gem bin名称)来收紧规则定期为sudoers文件(visudo)添加条目。



现在问题就是你试图使用RVM所做的系统ruby NOT 控制(它只是允许你通过设置正确的GEM_PATH,RUBY_ *环境变量等来访问它),或者你的RVM多用户安装不正确。


Whenever I bundle my rails 3.2 gems, it asks me for my password:

Enter your password to install the bundled RubyGems to your system

This gets really annoying, especially when bundling several times in one project. However, when I set the gem directory to world-readable, it always gives me a warning when executing any (!) rails command. This is even more annoying, of course.

How can I turn this off?

解决方案

Absolutely has to do with the system ruby, not RVM, unless you installed RVM using the Multi-User installation type. If you did that and its still asking you for your password, then you installed as root, strictly against what the listed documentation states, and your general user was not added to the 'rvm' group the installer creates. (NOTE: This is based on the idea that you want a multi-user install, not a single user one. If you want the single user install, not not prefix with sudo when you run the installer.)

Rip out RVM, log out then back in (to ensure a completely fresh reinitialization of the environment), and then rerun the installer command as your regular user, not as root, prefixing with 'sudo' as the documentation instructs.

If you do not have RVM installed, then follow the documentation at https://rvm.io to install either as a single user install, or as a multi-user install. In this case, without RVM installed, what Billy Chan described above is your fix, though I would suggest tightening the rules a bit by figuring out which exact set of commands (gem bin names) you need to run on a regular basis and adding entries for those in the sudoers file (visudo).

Right now the problem reads you trying to use the system ruby which *RVM does NOT control (it simply allows you access to it by setting the proper GEM_PATH, RUBY_* environment variables etc), or your RVM multi-user install was done incorrectly.

这篇关于安装宝石时不要求输入密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆