Reputation: 3465
On my Windows machine, when I pull my repo I get:
error: unable to crate file <path to file> (Permission denied)
I think the problem might be that when I look at the properties of the folder there is a square inside the checkbox, I clear it out so that no files or folders will be read only.
After pressing ok and checking to see if Windows applied my changes, I see the square again!
How can I get Git or Windows to allow me to get my commits?
Upvotes: 51
Views: 154178
Reputation: 360
I tried all suggestions, none worked. Then i tried existing solutions again to check if any app is causing it. It was Avast antivirus !!
Upvotes: 0
Reputation: 31
Adding this as for me none of the above answers worked: if you have it installed, check Bitdefender settings (or other security software you have). It operates with protected folders and might block any attempts to manipulate files. When using for example git bash, commands like rm, vim, etc., all count as separate ones and need separate permissions - not only bash.exe itself.
Upvotes: 3
Reputation: 20162
In my situation with the same problem it was another program ( Atom ) which blocked files. Closing it helped.
So check if any other program, code editor is using the same files, if yes - turn it off.
Upvotes: 21
Reputation: 932
Git Bash on Windows 10. The file was not read-only, so I closed the bash window and opened again and it worked.
Upvotes: 0
Reputation: 41468
I just had this kind of error after aborting a rebase. Turned out there was an orphaned git
process that was keeping a lock on a file in .git
directory.
Otherwise a script from this answer might also be useful.
Upvotes: 2
Reputation: 493
Check if another application is using your files and kill it. In my case it was grunt, always watching for the changes and building project. Gave me the same message as yours, when discarding files.
How it happened? When I've switched to another branch, some non-existent files appeared in my working copy. I could not Discard them, nor open in the text editor.
Upvotes: 35
Reputation: 301527
Run the Git Bash or the console you are running, with Run As Administrator
Upvotes: 58