hudac hudac - 5 months ago 22
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
dir1/dir2/.gitignore
.
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


file1
is the file that supposed to be under the path
dir1/dir2/file1
.

Is there a way to fix this?

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

Answer

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

Manual

Comments