hudac hudac - 1 year ago 59
Linux Question

Git won't add files - 'Permission denied'

Suddenly simple git functionality doesn't work.

When I'm trying to

git add
, I get the following error:

hudac@ubuntu:~/progg$ git add . --all
warning: unable to access 'dir1/dir2/.gitignore': Permission denied

I never created
This is strange:

hudac@ubuntu:~/progg$ ll dir1/dir2
ls: cannot access dir1/dir2/..: Permission denied
ls: cannot access dir1/dir2/.: Permission denied
ls: cannot access dir1/dir2/file1: Permission denied
total 0
d????????? ? ? ? ? ? ./
d????????? ? ? ? ? ? ../
-????????? ? ? ? ? ? file1

is the file that supposed to be under the path

Is there a way to fix this?

It happened after I
chmod 644 -R dir1/dir*

Answer Source

You made your files and FOLDERS within 'dir1' have the 644 permissions when you ran that command which is the problem here.

Run this to reset the folder 'dir2' to the correct permissions

chmod 755 dir1/dir2