Tom Lilletveit
Tom Lilletveit

Reputation: 2002

Xcode and Git: fatal: Not a git repository after removing .git folder in project

I deleted the .git folder from my project as it had a large size and I did not need it. Now I get the problem when trying to rename one of my files fatal: Not a git repository (or any of the parent directories): .git

So i went into the organizer and removed the project from the repositories tab. Save and reopen, but when the project opens a new repository is created, and the same message again when I try to rename

Upvotes: 1

Views: 2063

Answers (1)

Ricardo Sanchez-Saez
Ricardo Sanchez-Saez

Reputation: 9566

Xcode probably has some Git metadata elsewhere and that probably is making it confused when it doesn't find the .git folder (where all the repository commit data was).

Things to try: Product -> Clean and Organizer -> Projects -> Delete derived data.

If that doesn't work, here's a more extreme workaround.

  • Create a new project on Xcode from scratch, unticking the Create repository box in Xcode. Then move all your files from your broken project to the new one.

Edit: As per OP's comment, make sure you actually deleted the .git folder (if that is what you actually want to do). This is a hidden folder and it doesn't normally show in Finder. You can list and delete it from the Terminal.

Upvotes: 2

Related Questions