Could not create work tree dir 'example.com'.: Permission denied

前端 未结 10 617
感动是毒
感动是毒 2020-12-24 05:32

I have got a virtual private server with nginx Virtual Hosts setup (Server Blocks).

I\'ve installed Git and got my ssh keys authenticated with GitHub.

I have

相关标签:
10条回答
  • 2020-12-24 05:43

    use this for all user

    sudo chown -R $(whoami):$(whoami) /var/..
    
    0 讨论(0)
  • 2020-12-24 05:45

    I was facing the same issue but it was not a permission issue.

    When you are doing git clone it will create try to create replica of the respository structure.

    When its trying to create the folder/directory with same name and path in your local os process is not allowing to do so and hence the error. There was "background" java process running in Task-manager which was accessing the resource of the directory(folder) and hence it was showing as permission denied for git operations. I have killed those process and that solved my problem. Cheers!!

    0 讨论(0)
  • 2020-12-24 05:49

    Tested On Ubuntu 20, sudo chown -R $USER:$USER /var/www

    0 讨论(0)
  • 2020-12-24 05:53

    Most common reason for this error is that you don't have permission to create file in the current directory. Ensure you are in the right directory. try this on mac system to list the directory

    ls, then cd right_folder_name

    0 讨论(0)
    1. Open your terminal.
    2. Run cd /
    3. Run sudo chown -R $(whoami):$(whoami) /var

    Note: I tested it using ubuntu os

    0 讨论(0)
  • 2020-12-24 05:57

    Turns out the problem was in the permission. I fix it with the following command

    sudo chown -R $USER /var/www
    

    Please make sure with the $USER variable. I tested and worked on Ubuntu Distro

    0 讨论(0)
提交回复
热议问题