Source control ADD grayed out

- I need to add files to GIT, and have a repository there, but I can't commit any files, because Xcode says none of them are under source control. BUT, I can't add them to source control, because Source Control-Add is gray! How do I enable this menu item??

OS X Mountain Lion (10.8.3)

Posted on Apr 16, 2013 12:54 PM

Reply
1 reply

Apr 16, 2013 8:59 PM in response to mamadeo

Creating Git repository for existing XCode projects


This problem has been puzzling me for a while...


Scenario 1:
You started a simple project just for a quick/simple test.
XCode gives you option to "Create local git repository for this project", and for some reason you didn't/forgot to tick it...

User uploaded file


After you spent some time on it, your simple proof-of-concept project seems to worth a lot more now and you want to add it to the source control. Ooops, how do you do that again??!! You tried every possible options under "File -> Source Control" menu but none of them works, what the....$%#@!


I guess it's mainly your fault for not creating the repository at the beginning, but, but, but, wouldn't it be nice if Apple can add an option into XCode to make it easier to add existing projects to the the source control?

Scenario 2:

There's another scenario - which happens to me quite a lot - you downloaded something from the web, you "heavily" modified it (it's mine now, mine mine mine! Ha ha ha....), and again, later wants to add it to source control and..... stuck again!


Finally found a solution today, thanks to this link by Ash Furrow, I learned that you have to:


(a) create an empty repository by open a terminal, go to your project directory and run the following commands:


git init git add . git commit -m "Initial commit"

(b) after that, follow the following steps (you may compress the whole project into a ".gz" file first if you worried about loosing anything...)



  1. Move your existing project folder to your desktop.
  2. Make a new, empty project in Xcode with the same name as your project. Make sure the box for using a .git repo is selected.
  3. Close Xcode.
  4. Copy all files from the project folder on your desktop to the new project folder Xcode created.
  5. Double-click the project file.
  6. You'll now need to add all the files to the source control since (they'll all have question marks beside them, shown right).

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Source control ADD grayed out

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.