WCG WCG - 1 month ago 15
Git Question

Cannot use git hub extension as root

What do I need to run git hub as root?

git hub
works perfectly in non root user.

To install it as root, I ran
brew install hub
which lead to

# 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


It seems to linked with
brew
ran as root.

The alternative would be to use
sudo -u
, but the command is not recognized. Why is it so?

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

Answer

The solution is to install hub from a regular user.

$ brew install hub

and to add /usr/local/bin to the $PATH of root user (if it's not already the case.)