unable to access '/Users/dida/.config/git/attributes': Permission denied

Viewed 26025

When I do some git operations, such as 'git diff' or 'git add .', it shows that warning:

unable to access '/Users/dida/.config/git/attributes': Permission denied 

I wonder which config I did wrong and how can I fix it?
It's better with some commands, I am using mac command line

6 Answers

Upon finding out more information on the file, I noticed the file was not owned by my user("ubuntu"), but by "root" instead.

ls -dl /home/$USER/.config to find out the user and group of the file


sudo chown $USER -R /home/$USER/.config to update the user of the file sudo chgrp $USER -R home/$USER/.config/ to update the group of the file to the your current user

Now, when you get the file details using ls again, you'll see the information was updated.

That fixed it for me.

warning: unable to access '/Users/raavan/.config/git/ignore': Permission denied warning: unable to access '/Users/raavan/.config/git/attributes': Permission den

ok! if you had something similar, this is the solution. use sudo command

sudo git add --all, sudo git commit -m ""

this will work and worked for me in mac os.

if anyone knows why the sudo command worked or alternative way please respond!.

Related