Unable to access 'git/attributes'

后端 未结 6 826
感动是毒
感动是毒 2020-11-29 18:23

What does warning remote: warning: unable to access \'/root/.config/git/attributes\': Permission denied means and what implications does it bring?



        
相关标签:
6条回答
  • 2020-11-29 18:43

    Git is trying to read config from root instead of user config. Please check your environment variables have the correct git config set or the .gitconfig file in your home folder is accessible.

    0 讨论(0)
  • 2020-11-29 18:46

    I've ran the similar issue and was able to fix it on server side. git runs there under uwsgi so I added in uwsgi config the following line:

    env = HOME=/srv/git
    

    where /srv/git is owned by the same uid that uwsgi runs under and made chmod u+rwX /srv/git So, you need to point HOME variable on server side for the process that runs git to the directory where this process will have reading/writing/traverse permissions.

    0 讨论(0)
  • 2020-11-29 18:47

    I think your HOME envireonment variable is improperly set.

    From the google group thread,

    the HOME environment variable was set to /root so it looked at /root/.gitconfig or /root/.config/git/config since the unprivileged user didn't have access to /root it threw an error.

    So the solution was for me to set the HOME env to the user's HOME directory

    0 讨论(0)
  • 2020-11-29 18:48

    Go to root directory

    cd ~/

    Write the following code:

    sudo chown -R username /Users/username

    Where username is your system's username.

    0 讨论(0)
  • 2020-11-29 18:50

    I ran into this situation myself. After verifying that it was looking in ~/.config/ I noticed the owner of that folder was root. I changed this to my_user_name and it worked.

    cd ~/
    ls -al
    <Noticed .config was owned by root, unlike everything else in $HOME>
    sudo chown -R $(whoami) .config
    

    It helps to know the cause as well: This directory is created the first time you run a program that uses it. If the command was run as root, it will cause this permissions problem.

    For example, if the ~/.config directory does not yet exist, and you run sudo htop, the directories ~/.config and ~/.config/htop will be created and owned by root. Afterward, a regular git command wont be able to access ~/.config and will give the above warning. (Credit: user mehtunguh)

    The -R option with chown is to modify the permissions recursively. This will help if you have subfolders under ~/.config

    0 讨论(0)
  • 2020-11-29 19:04

    For Windows, it may be a case when some process like CMD or SSH client opened some folder which Git tries to delete.

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