如何在XCode 4中添加现有项目作为工作副本?

时间:2023-01-13 20:51:14

Today I switched from XCode 3 to XCode 4 and now I have a lot of problems with my projects, which were under version control in XCode 3. If you install XCode 4, it will remember all your repositories. The problem is, that the projects don't know, that they belong to a specific repository. The instructions of Apple are easy, but do not work:

今天我从XCode 3切换到XCode 4,现在我的项目有很多问题,在XCode 3的版本控制下。如果您安装了XCode 4,它将记住所有的存储库。问题是,项目不知道它们属于特定的存储库。苹果的说明很简单,但并不奏效:

If you have a working copy of a project that was checked out of Subversion or cloned from Git using the command line or another tool, you can add it to your Xcode SCM repository support. To do so, click the Add button (+) at the bottom of the navigation pane in the repository organizer and choose Add Working Copy.

如果您有一个从Subversion中检出的项目的工作副本,或者使用命令行或其他工具从Git中克隆出来的项目,您可以将它添加到您的Xcode SCM存储库支持中。为此,单击存储库管理器中导航窗格底部的Add按钮(+),并选择Add Working Copy。

If I choose the project directory, I get this:

如果我选择项目目录,我会得到:

The working copy could not be added because its repository could not be located.

无法添加工作副本,因为无法定位其存储库。

Does anybody know what the problem is?

To avoid confusion, I want to make a few things clear: my projects were under version control in XCode 3 and it worked. I am also aware of the fact, that I could delete all my projects and check them out (I don't want to do that). I already tried to checkout a project, and then this project is automatically added as a working copy. However if I remove the reference and try to add the same (!!) project as a working copy again, it does not work either.

有人知道问题出在哪里吗?为了避免混淆,我想澄清几件事:我的项目在XCode 3中处于版本控制之下,并且运行良好。我也意识到这样一个事实:我可以删除所有的项目并检查它们(我不想那样做)。我已经尝试签出一个项目,然后这个项目将自动添加为一个工作副本。但是,如果我删除引用并尝试将相同的(!!)项目作为工作副本再次添加,它也不能工作。

4 个解决方案

#1


24  

The key for me was quitting Xcode then following Apple's instructions exactly. In Terminal:

我的关键是退出Xcode,然后严格按照苹果的指示去做。在终端:

  1. $ cd project_folder # project containing the .xcodeproj file
  2. $ cd project_folder #项目,包含.xcodeproj文件
  3. $ git init
  4. git init美元
  5. $ git add . # note the dot after "add"
  6. git添加美元。#注意“添加”后的点
  7. $ git commit -m 'Initial version text'
  8. $ git提交-m“初始版本文本”

Then get back into Xcode, open the Organizer, et voilà — instant repository.

然后回到Xcode中,打开管理器,等等——即时存储库。

#2


6  

I was able to resolve this by quitting Xcode and then opening the repository organizer before opening my workspace. Then it worked and I could open my workspace with SVN integration.

我可以通过退出Xcode,然后在打开工作区之前打开存储库管理器来解决这个问题。然后它工作了,我可以用SVN集成打开我的工作空间。

#3


2  

In Terminal, you may get the error:

在终端,您可能会得到错误:

-bash: git: command not found

git:没有找到命令

This is because the git tool (and svn too) are contained inside the Xcode.app bundle in XCode 4.5 or later. In order to run the contained tools you need to use the xcrun command. For example, to run the git commands mentioned in the posts above:

这是因为git工具(以及svn)包含在Xcode中。应用程序包在XCode 4.5或更高版本中。为了运行包含的工具,您需要使用xcrun命令。例如,运行上面文章中提到的git命令:

  1. $ xcrun git init
  2. 美元xcrun git init
  3. $ xcrun git add .
  4. $ xcrun git增加。
  5. $ xcrun git commit -m 'Initial version text'
  6. $ xcrun git提交-m“初始版本文本”

For more info, see this link: http://www.cocoanetics.com/2012/07/you-dont-need-the-xcode-command-line-tools/

要了解更多信息,请参见此链接:http://www.cocoanetics.com/2012/07/youtxt -the-xcode-command-line-tools/。

#4


1  

What I had to do was, as Udi pointed out, close Xcode and open the organizer before opening any projects. But then I had to add the repository and it's credentials first (SVN, in this case) before following the Apple directions you (mowidev) posted. After doing this, the working copy then appeared inside the listing for the SVN repository I'd added.

正如Udi所指出的,我要做的是,在开始任何项目之前关闭Xcode并打开组织者。但是,我必须先添加存储库和凭证(在本例中是SVN),然后才能按照您发布的Apple directions (mowidev)。这样做之后,工作拷贝就出现在我添加的SVN存储库的列表中。

That ultimately linked in the two (Xcode project source control settings with the existing working copy it was using). Anything out of order ended up with Xcode thinking it was a Git repo (that also didn't exist).

这最终会在两个(Xcode项目源代码控制设置中使用现有的工作副本)链接。任何不正常的东西最终都会导致Xcode认为它是Git repo(它也不存在)。

#1


24  

The key for me was quitting Xcode then following Apple's instructions exactly. In Terminal:

我的关键是退出Xcode,然后严格按照苹果的指示去做。在终端:

  1. $ cd project_folder # project containing the .xcodeproj file
  2. $ cd project_folder #项目,包含.xcodeproj文件
  3. $ git init
  4. git init美元
  5. $ git add . # note the dot after "add"
  6. git添加美元。#注意“添加”后的点
  7. $ git commit -m 'Initial version text'
  8. $ git提交-m“初始版本文本”

Then get back into Xcode, open the Organizer, et voilà — instant repository.

然后回到Xcode中,打开管理器,等等——即时存储库。

#2


6  

I was able to resolve this by quitting Xcode and then opening the repository organizer before opening my workspace. Then it worked and I could open my workspace with SVN integration.

我可以通过退出Xcode,然后在打开工作区之前打开存储库管理器来解决这个问题。然后它工作了,我可以用SVN集成打开我的工作空间。

#3


2  

In Terminal, you may get the error:

在终端,您可能会得到错误:

-bash: git: command not found

git:没有找到命令

This is because the git tool (and svn too) are contained inside the Xcode.app bundle in XCode 4.5 or later. In order to run the contained tools you need to use the xcrun command. For example, to run the git commands mentioned in the posts above:

这是因为git工具(以及svn)包含在Xcode中。应用程序包在XCode 4.5或更高版本中。为了运行包含的工具,您需要使用xcrun命令。例如,运行上面文章中提到的git命令:

  1. $ xcrun git init
  2. 美元xcrun git init
  3. $ xcrun git add .
  4. $ xcrun git增加。
  5. $ xcrun git commit -m 'Initial version text'
  6. $ xcrun git提交-m“初始版本文本”

For more info, see this link: http://www.cocoanetics.com/2012/07/you-dont-need-the-xcode-command-line-tools/

要了解更多信息,请参见此链接:http://www.cocoanetics.com/2012/07/youtxt -the-xcode-command-line-tools/。

#4


1  

What I had to do was, as Udi pointed out, close Xcode and open the organizer before opening any projects. But then I had to add the repository and it's credentials first (SVN, in this case) before following the Apple directions you (mowidev) posted. After doing this, the working copy then appeared inside the listing for the SVN repository I'd added.

正如Udi所指出的,我要做的是,在开始任何项目之前关闭Xcode并打开组织者。但是,我必须先添加存储库和凭证(在本例中是SVN),然后才能按照您发布的Apple directions (mowidev)。这样做之后,工作拷贝就出现在我添加的SVN存储库的列表中。

That ultimately linked in the two (Xcode project source control settings with the existing working copy it was using). Anything out of order ended up with Xcode thinking it was a Git repo (that also didn't exist).

这最终会在两个(Xcode项目源代码控制设置中使用现有的工作副本)链接。任何不正常的东西最终都会导致Xcode认为它是Git repo(它也不存在)。