So, I have been working on a project and have been using git to push to github, and then suddenly today after I have been working for a little while I went to git add
and got fatal: .git/index: index file open failed: Permission denied
I can't think of anything I have done recently on my computer that would cause this. Although I woke up today noticing my computer had rebooted overnight, and I noticed some different settings were not how I normally leave them. For instance quiet mode was turned off, and I always have that on. Thought it was kind of weird but ran a virus scan and didn't notice anything so I shrugged it off thinking it may be something on window's end.
Should I be nervous something is playing with my permissions? After a few minutes of googling I haven't found out too much on this error. Kinda baffled because I haven't personally changed any permissions and it everything seemed fine yesterday.
Looking for some help, if there is anything else I need to include to solve this error I'll gladly provide it if asked. Nobody else uses this computer. It is a Windows 10 build, git version 2.6.3.windows.1
.
edit: Here's the output
11:21:34.673917 trace.c:319 setup: git_dir: .git
11:21:34.674417 trace.c:320 setup: git_common_dir: .git
11:21:34.674417 trace.c:321 setup: worktree: D:/Downloads/AnotherTabExample
11:21:34.674417 trace.c:322 setup: cwd: D:/Downloads/AnotherTabExample
11:21:34.674417 trace.c:323 setup: prefix: (null)
11:21:34.674417 git.c:348 trace: built-in: git 'add' '.'
fatal: .git/index: index file open failed: Permission denied
Mark: If you have this error in Android studio, just restart your android studio and this error will be solved. I guess that This is because of some 'cache' or 'bug' of intellij idea.
From the verbose output, it appears that the permissions of the .git/index
while might have gotten corrupted.
Confirm that this is the case by doing a ls -al .git/index
followed by a chmod 644 .git/index
to fix it. Then try running the git add
command again.
It turned out to be a (Windows) permissions issue. What worked was simply creating a copy from within msysgit of the original folder and using that (i.e. cp -rvf original original-bkup
).
A reset of the permissions on the original folder should have worked, but didn't.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With