Wednesday, July 13, 2011

Xcode 4: Fatal: Not a git repository

Introduction


Recently I created a new project and at some point I uploaded it to SVN. I am not quite sure how to reproduce this situation but somehow the versioning support of Xcode 4 decided to interpret the project as a git repository.

Each time I tried to copy a file per drag and drop into my project I got following error:
fatal: Not a git repository (or any of the parent directories): .git

The result was that the file got copied into the project folder, but the reference didn't get set in the project. I had to go into the folder and drag and drop the file again and uncheck the copy option this time, so that the reference gets set.

The Solution


1. Open Xcode and go to Window > Organizer
2. Find under repositories your project. It might be two entries if you use something like SVN.
3. Make sure it says "Type Git"
4. Mark the repository entry and hit backspace or delete (on mac)
5. Done