Using git / folder owned by root

11,419

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 .....
Share:
11,419

Related videos on Youtube

Jesse Boogaard
Author by

Jesse Boogaard

Updated on September 18, 2022

Comments

  • Jesse Boogaard
    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
    Yaron almost 7 years
    @user535733 Thanks for the commet!
  • jtlz2
    jtlz2 about 2 years
    chown: changing ownership of ‘...’: Operation not permitted
  • Yaron
    Yaron about 2 years
    @jtlz2 please add the original command you enter before you got the error