Dilip Manek
Dilip Manek

Reputation: 9143

I got this strange error when delete files in xcode

When I try to delete things from my xCode project I get this strange error does not know why. It's seems like git error but I have not created git repository in my project.

This is the error:

fatal: Unable to create '/Users/dilipmanek/.git/index.lock': File exists.

If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.

Plz help me solve this problem..

Upvotes: 0

Views: 361

Answers (1)

Joachim Isaksson
Joachim Isaksson

Reputation: 180887

Exit XCode, go to a command prompt and type rm /Users/dilipmanek/.git/index.lock. Apparently you have a git repo of your entire home directory whether you meant to or not :)

If the git repository is there by mistake, you can go to a command prompt and type;

(always be careful with rm -r, it will remove all files under the directory given, so don't do it to your entire home directory for example)

rm -r /Users/dilipmanek/.git

...and remove the entire git repository. It will not affect any files that aren't placed in that directory, but make sure you've not copied anything you need to keep there.

The reason XCode won't delete the file is that when it finds a git repo, it will attempt to use it. Git locks files by creating a temporary file in the git directory, and if XCode crashes while doing any file operation, the file is left there and the next instance of XCode will think the repository is locked.

Upvotes: 2

Related Questions