How to add a new project to source control in Xcode 4?

33,752

Solution 1

Open Organizer. Click on the root of your SVN repository in the tree on the left. Click on Import on the bottom right and choose the directory from finder that you want to add and click Import.

This will add the project to SVN

Solution 2

The XCode 4 documentation recommend using command-line tools or a utility program to set up a Git or Subversion repository.

To set up a Subversion repository using the command line

1/ Open the Terminal utility and use the svnadmin create command to create a Subversion repository.
For example, if you want a repository named Sketch_svn in the existing location /Users/myUserName/Repositories, you would enter the command:

  svnadmin create /Users/myUserName/Repositories/Sketch_svn

Tip: The easiest way to get the full path to a folder into Terminal without risking typing errors is to first type the command (cd in this case), enter a space, and then drag the folder from the Finder and drop it at the end of the Terminal command line.

Note that the directory /Users/myUserName/Repositories/ must already exist before you execute this command. You can use the Finder or a mkdir command to create the directory.

2/ In another location—not in the repository you just created—create a folder to hold a temporary copy of the project. In that folder, create three additional folders named branches, tags, and trunk.

3/ Create a new Xcode project in the trunk folder, using Xcode, or put your existing project in the trunk folder, using the command line or the Finder.

4/ Use the svn import function to import your project into the repository you created and place it under Subversion source control.
For example, if your temporary copy is in /Users/myUserName/Projects/Sketch_tmp, you would enter the following command in Terminal:

svn import /Users/myUserName/Projects/Sketch_tmp \
  file:///Users/myUserName/Repositories/Sketch_svn -m "Initial import"

Notes

  • The backslash at the end of the first line indicates that the command is continued on the next line. You can omit the backslash and type the entire command on one line. If you do use the backslash, be sure there are no spaces following it before you press Return.
  • There are three forward slashes in the string file:///.
  • If you type the entire command on one line, be sure there is a space before file:///.
  • You can include any comment you want in the quotation marks, but be sure your comment will be meaningful to anyone using the repository.

5/ In the repositories organizer in Xcode, click the Add (+) button at the bottom of the navigator pane, and choose Checkout Repository to create a working copy.

Share:
33,752
TheLearner
Author by

TheLearner

Updated on September 17, 2020

Comments

  • TheLearner
    TheLearner over 3 years

    How do I add a new project to source control (SVN) using Xcode 4?

  • lilbyrdie
    lilbyrdie almost 13 years
    One thing to be aware of here... Xcode apparently doesn't have a default svn:ignore. So, if the project was previously under git (or you want local git with remote svn) this import will add the .git directory. It will also add other user directories and files that you may or may not want under source control.
  • user4234
    user4234 over 11 years
    What is SVN? What does it stand for?
  • Josh
    Josh almost 9 years
    I hate squandering time on stuff like this instead of programming, but anyways thanks for your help! It works in Xcode6.3 too!