SSH KEY: sudo git clone permission denied
Since you were running git
as root, presumably it tried to log in with root's ssh keys (if any), not yours.
Why does git needs sudo privileges to clone and if so, writes to root directory?
This is not Git, this is the install script for oh-my-zsh.
install.sh is trying to clone a repository. Where it installs is controlled by the ZSH environment variable. By default it will install into ~/.oh-my-zsh
. If it went into /usr/share/oh-my-zsh you had ZSH set to that. You don't have permission to write to /usr/share. This is normal, a regular user should not have /usr/share permission.
When run with sudo
(ie. with root permissions) it does have permission to write to /usr/share/oh-my-zsh
, but sudo
will clean up your environment variables so ZSH was not set for the command. It ran with its default ~/.oh-my-zsh
. Normally sudo should preserve your home directory, but somehow it isn't and it's gone into root's home directory.
How to "fix" this depends on what you want. First, check what's in your environment with env | sort
and make sure it's all correct.
If you just want to install the software for yourself, unset ZSH
and run the installer. It will go into ~/oh-my-zsh.
If you want to install the software for everyone, download the script, use sudo
and make setting ZSH part of the command.
cd /tmp
curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh
sudo ZSH=/usr/share/oh-my-sh sh -c install.sh
Related Topics
How to Check If Sed Has Changed a File
How to Decode /Proc/Pid/Pagemap Entries in Linux
Sorting on the Last Field of a Line
Grep Inside All Files Created Within Date Range
Linux Bash, Camel Case String to Separate by Dash
How to Get Position of Cursor in Terminal
Running 32 Bit Assembly Code on a 64 Bit Linux & 64 Bit Processor:Explain the Anomaly
Anything Like Dos2Unix for Windows
Can't Detach Child Process When Main Process Is Started from Systemd
How Clear and Invalidate Arm V7 Processor Cache from User Mode on Linux 2.6.35
How to Do Memory Test on Arm Architecture Hardware? (Something Like Memtest86)
Suid Not Working with Shell Script
How to Get the Difference Between Two Dates Under Bash
Piping Text to an External Program Appends a Trailing Newline
Differencebetween "./Somescript.Sh" and ". ./Somescript.Sh"