问题
This is really not a duplicate question. I tried few solutions like reset head^ , git checkout -- <file>,... but this does not solve my problem. The problem is that I can not revert the index.php file from "Changes not staged for commit" from git status because it throws me an error:
Unable to create file www/index.php: Permission denied during executing git "C:\Program Files\Git\bin\git.exe" -c core.quotepath=false checkout HEAD -- www/index.php
I dont understand what is wrong with that. I am an admnistrator, console runs as administrator.. I have all permissions to do this so what permission I need? What the hell is wrong? Help me please I am in the end.
回答1:
The problem with Git error - permission denied in this case has been caused by the incriminated file was open in other process. The solution was to shut down all the apps except one console, then run git checkout -- www/index.php and everything works as excepted without any trouble.
回答2:
When I did git checkout -- www/index.php this didn't work for me so My problem was happening because the antivirus had moved my file www/index.php to the virus trunk (baúl de virus)
来源:https://stackoverflow.com/questions/48782925/win-10-git-unable-to-create-file-permission-denied