0

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 :)

Update 1:

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:

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.

It also provides several steps:

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.

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 https://i.stack.imgur.com/jWXvx.png

https://i.stack.imgur.com/K6MqG.png

Update 2:

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...

Shane Hou
  • 4,808
  • 9
  • 35
  • 50

3 Answers3

1

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.
2) Copy your Xcode project into the trunk subdirectory.
3) Use the svnadmin create command to create an empty Subversion repository.
4) Use the svn import command to import your project into the new Subversion repository.

examples -

  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"
Saurabh
  • 22,743
  • 12
  • 84
  • 133
0

Please read the steps given in the xcode 4 user guide

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.

hp iOS Coder
  • 3,230
  • 2
  • 23
  • 39
0

Finally I found the right step:

  1. Follow steps provided by @Saurabh.

  2. Just restart your Xcode, DON'T DO ANYTHING ELSE LIKE THE DOCUMENT SAYS AFTER, Xcode will find the repository itself, and manage it automatically.

Shane Hou
  • 4,808
  • 9
  • 35
  • 50