The situation is, I forgot to choose "use source control" in Xcode when creating my project. Then I found I can't update anything without source control selected, but also can't find where can add SCM to the project I've already created. Re-create a new project is a stupid idea, so if anyone met the same issue before PLZ gimme a hand :)
I tried command line to set up git repository and it succeeded. But just add git to project is not enough, you have to add it to the oragnizer as a repository so Xcode can find where to check out or update your code. Then I encountered another issue:
In Xcode 4 user guide it says:<blockquote>
By abstracting common repository operations, Xcode supports both Git and Subversion (SVN) repositories with a single, unified graphical user interface and workflow. Depending on your choice, this one operation checks out (for SVN) or clones (for Git) the repository and integrates it with your project.
Cloning a Git repository in Xcode sets up a complete repository on your local system and integrates that repository with your workspace so that you can quickly start using it. This approach gives you the benefits of distributed version control, including full commit rights, whether you’re online or not.</blockquote>
It also provides several steps:<blockquote>
In the repositories organizer, click the Add button and choose Checkout or Clone Repository.
Enter the pathname or URL for the file.
When the “Host is reachable” indicator turns green, click the Next button.
Enter a local name for the repository and click Clone (or Checkout) to copy it.
Choose a location and click the highlighted Clone (or Checkout) button to save the local repository.</blockquote>
When I went to step 3, a yellow lamp occurred instead of a green one and said "authentication required".
I clicked next button, and clone failed. Then it showed NOTHING, no error log or notice or anything else.
When I clicked previous button it also showed nothing, so I think it's a bug of Xcode Version 4.3.2 (4E2002).
Seems newbie can't post image... link below: T_T <a href="http://i.stack.imgur.com/jWXvx.png" rel="nofollow">http://i.stack.imgur.com/jWXvx.png</a>
<a href="http://i.stack.imgur.com/K6MqG.png" rel="nofollow">http://i.stack.imgur.com/K6MqG.png</a>
Besides, I also tried "Add repository" instead of "Checkout or Clone Repository". It gave me the same notice again, but after a short while I saw a green lamp. Unfortunately a label said "Unable to load revisions" showed at center of screen, and seems it still can't work.
I googled for these issues but can't find any valuable answer.
Update 3: I tried to restart my MAC and Xcode, then this problem fixed itself... it's very complicated...Answer1:
If you want to use git as your version control system then go to your project folder on terminal and run these commands -
git init git add . git commit -m "Initial commit"
Or if you want to use SVN as your version control system then follow this
1) Use the mkdir command to create a directory with three subdirectories named branches, tags, and trunk to hold a temporary copy of your project.<br /> 2) Copy your Xcode project into the trunk subdirectory.<br /> 3) Use the svnadmin create command to create an empty Subversion repository.<br /> 4) Use the svn import command to import your project into the new Subversion repository.
mkdir /Repo_Master/Sketch_svn_tmp/trunk mkdir /Repo_Master/Sketch_svn_tmp/branches mkdir /Repo_Master/Sketch_svn_tmp/tags cp -R /Library/MyProjects/Sketch /Repo_Master/Sketch_svn_tmp/trunk svnadmin create /Repo_Master/Sketch_svn svn import /Users/myUserName/Projects/Sketch_tmp \ file:///Users/myUserName/Repositories/Sketch_svn -m "Initial import"Answer2:
Please read the steps given in the <a href="https://developer.apple.com/library/ios/#documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40010215" rel="nofollow">xcode 4 user guide</a>
In this guide look for "managing versions of your project". They have given ways to add SCM (git & svn) to existing project using some terminal commands.Answer3:
Finally I found the right step:<ol><li>
Follow steps provided by @Saurabh.</li> <li>
Just restart your Xcode, DON'T DO ANYTHING ELSE LIKE THE DOCUMENT SAYS AFTER, Xcode will find the repository itself, and manage it automatically.</li> </ol>