【问题标题】:Cannot use git hub extension as root不能以 root 身份使用 github 扩展
【发布时间】:2016-10-06 12:56:17
【问题描述】:

以 root 身份运行 git hub 需要什么?

git hub 在非 root 用户中完美运行。

要以 root 身份安装它,我运行了 brew install hub 导致

# brew install hub                                                                                                                                 
W: be careful as root.

========================================================================
You may want to update following environments after installed linuxbrew.

  PATH, MANPATH, INFOPATH

(example: /usr/share/doc/linuxbrew-wrapper/examples/profile)
========================================================================
Don't run this as root!
/usr/lib/linuxbrew-wrapper/install:110: warning: Insecure world writable dir /root in PATH, mode 040777

它似乎与brew 以root 身份运行。

替代方法是使用sudo -u,但无法识别该命令。为什么会这样?

$ sudo -u user 'git hub user myuser'
sudo: git hub user myuser: command not found

【问题讨论】:

  • 来自brew FAQHomebrew is designed to work without using sudo. You can decide to use it but we strongly recommend not to do so.

标签: git github homebrew root


【解决方案1】:

解决方案是从普通用户那里安装集线器。

$ brew install hub

并将/usr/local/bin 添加到root 用户的$PATH(如果还没有的话。)

为此,您可以使用以下命令:

echo export PATH="/usr/local/bin:$PATH" >> ~/.bash_profile

这样,/usr/local/bin 出现在/usr/bin 之前,如果两个位置都存在命令,则自制版本具有优先权。

【讨论】:

  • 是的,但您必须记住每次都输入sudo -u non_root_user。我的解决方案更干净。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-05-08
  • 1970-01-01
  • 2012-08-19
  • 1970-01-01
  • 2018-01-24
  • 1970-01-01
相关资源
最近更新 更多