0

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*

1
  • It doesn't matter, it was an example. It happens also with just git add . Commented Jun 20, 2016 at 19:07

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, though, I couldn't understand why it happened if I changed the permission to 644? Because git won't be able to write to this directories?
@hudac - That is absolutely correct. Generally in unix based systems 644 is standard file permission and 755 is standard directory permission. It does get alot more complicated though.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.