I am trying to clone a repository but this error shows up:
$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
Cloning Oh My Zsh...
fatal: could not create work tree dir '/usr/share/oh-my-zsh': Permission denied
Error: git clone of oh-my-zsh repo failed
If I use sudo before the previous command it writes to the root directory as you can see:
$ sudo sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
The $ZSH folder already exists (/root/.oh-my-zsh).
You'll need to remove it if you want to reinstall.
What's to be done to solve this? I know that git clone
should write to the current directory, but it doesn't! Why?