Using git / folder owned by root
The simple solution is to execute git clone
command in your /home
directory, in a location which is owned by you.
e.g. in a sub-folder dev-projects
in your /home/username
folder.
If from some reasons, the content of the git repository should be located in /opt/lampp/project-sbc
then you should execute the git clone
command as root, using the sudo
command:
sudo git ...... (your git command)
Also as mentioned in the comment:
The user can change the owner of the folder from root to himself.
sudo chown username /opt/lampp
Follow with git command in that folder
git clone .....
Related videos on Youtube
Jesse Boogaard
Updated on September 18, 2022Comments
-
Jesse Boogaard over 1 year
I decided to switch to Kubuntu from Windows.
I was setting up XAMPP which installs in
/opt/lampp/
.Now I want to set up my work environment for a project I'm working on but git doesn't have permission to access root.
When I try to assign a folder (
/opt/lampp/htdocs/project-sbc/
) it says the following:Git: fatal: could not create work tree dir '/opt/lampp/project-sbc': Permission denied
How can I fix this?
-
Yaron almost 7 years@user535733 Thanks for the commet!
-
jtlz2 about 2 yearschown: changing ownership of ‘...’: Operation not permitted
-
Yaron about 2 years@jtlz2 please add the original command you enter before you got the error