Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to access 'git/attributes'

Tags:

git

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

$git clone git://git.eclipse.org/gitroot/egit/egit.git
Cloning into 'egit'...
remote: warning: unable to access '/root/.config/git/attributes': Permission denied
remote: Counting objects: 57926, done.
remote: Compressing objects: 100% (11872/11872), done.
remote: Total 57926 (delta 30734), reused 56308 (delta 29136)
Receiving objects: 100% (57926/57926), 32.29 MiB | 1021 KiB/s, done.
Resolving deltas: 100% (30734/30734), done.
Checking out files: 100% (1483/1483), done.

Should I report potential infrastructure problem to hoster?

like image 554
Basilevs Avatar asked Nov 26 '14 13:11

Basilevs


4 Answers

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

like image 116
BlackVegetable Avatar answered Nov 18 '22 19:11

BlackVegetable


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

like image 12
Anshul Goyal Avatar answered Nov 18 '22 19:11

Anshul Goyal


Go to root directory

cd ~/

Write the following code:

sudo chown -R username /Users/username

Where username is your system's username.

like image 6
Arti Prasad Avatar answered Nov 18 '22 19:11

Arti Prasad


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.

like image 3
Vishal Avatar answered Nov 18 '22 20:11

Vishal