gpt4 book ai didi

xcode - 在 Xcode 4 中如何将项目关联到我设置的本地 Git 存储库?

转载 作者:太空狗 更新时间:2023-10-29 14:34:20 25 4
gpt4 key购买 nike

在 Xcode 4 中如何将项目关联到我设置的本地 Git 存储库?

即:

  • 我已经根据说明 here 在创建 Xcode 4 项目后设置了一个 Git 存储库:
  • 我已经转到 Organizer 并将其“添加”为本地 Git 存储库
  • 当我在 Xcode 4 中转到我的项目时,源代码函数似乎仍然无法工作 - 我猜是因为一定有某种方法可以将 Xcode 项目与我创建的本地存储库联系起来?

最佳答案

来自“How to Create Git Repos for Existing Xcode Projects”:

UPDATE: Apparently just initializing an empty repository in the project directory is enough; Xcode autodetects it for you.
It be nice if something to that effect was in the documentation. Thanks to Jason for that (details here). Open the project directory in a terminal and type the following:

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

所以在你的情况下,它应该检测到它。

OP Greg评论:

I found out that all I had to do was change a file, and then the Xcode 4 pop up menu for the file did show a source control set of options (previously greyed out).
So the initial part of the answer is correct re the manual git commands for creating the git repository.


否则你可以试试:

  • 创建一个新的 XCode4 项目,其中包含一个(空的)git 仓库
  • 移动您的 .git 目录并覆盖 Xcode 4 项目 .git
  • 将源代码移动到新的 Xcode 4 项目目录中
  • 查看 XCode4 是否检测到您的源 Git 集成

可能不是你的情况,但是one of the comments mentions :

If you're switching from an SVN repository (which I was), the trick is to go into your project folder and delete or rename the .svn directory.
For me it seemed that Xcode would find the .svn folder first (or preferred it, even though the backing repository was decommissioned), but once it was gone Xcode would happily start using the git repository.

那实际上是 issue for another Xcode 4 Git user here on SO .

关于xcode - 在 Xcode 4 中如何将项目关联到我设置的本地 Git 存储库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7265448/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com