Reputation: 509
I recently lost the ability to make any changes using Git on my Windows system. After a few days of not using my PC I come back to a non functional git so I have no idea what caused this issue.
git add or git checkout => fatal: Unable to create 'dummy-repo/.git/index.lock': No such file or directory
git clone => fatal: could not create work tree dir 'DummyRepo': No such file or directory
As a side note, this problem occured after trying to start my Flutter application, which could not retrieve the packages because of an OS error where access was denied. I'm thinking this is either because of some write permissions being messed up or a certain process locking a file.
Any help is appreciated!
Upvotes: 6
Views: 3883
Reputation: 329
I did 2 things:
Problem solved.
After I am done, I switched 'Controlled folder access' back on.
Upvotes: 0
Reputation: 6064
On Windows, this may happen if you enabled the "Ransomware protection" in Setting > Windows security > Virus & threat protection.
You need to add an exclusion for git.exe, or move the project outside a protected folder.
Upvotes: 20
Reputation: 509
I've solved it myself by changing the location of my project to C:\ instead of a way longer path. This was never a problem before but it works so I'm happy.
Upvotes: 3
Reputation: 5385
Try creating that file in your .git directory, you can use these commands in Git Bash or linux/mac
cd .git
touch index.lock
On Windows CMD
cd .git
type nul > index.lock
Upvotes: -1