在 xcode 中从 git 导入项目

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18084928/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 04:52:25  来源:igfitidea点击:

Import project from git in xcode

xcodegit

提问by Anton

I have a project under source control with at remote repository where I commit and push to.

我在我提交和推送到的远程存储库中有一个受源代码控制的项目。

Now I need to have another programmer work on the same project and therefore same Git repo.

现在我需要让另一个程序员在同一个项目上工作,因此需要同一个 Git 存储库。

I cannot figure out how one imports a project from an existing Git repo.

我无法弄清楚如何从现有的 Git 存储库导入项目。

I have worked with Eclipse and Git where I have no problem doing this.

我曾与 Eclipse 和 Git 合作过,在这方面我没有问题。

Any help is appreciated.

任何帮助表示赞赏。

回答by Adam Richardson

For xCode 6 and lower

对于 xCode 6 及更低版本

In xCode go to Window >> Organiser

在 xCode 中,转到 Window >> Organizer

Then select repositories

然后选择仓库

Click the + button and select Checkout or Clone repository

单击 + 按钮并选择 Checkout 或 Clone repository

Then enter the details for your GIT

然后输入您的 GIT 的详细信息

For xCode7 and above

对于 xCode7 及以上

Go to Window >> Welcome to xCode

转到窗口 >> 欢迎使用 xCode

Click on the Check out an existing projectbutton on the left hand side.

单击左侧的Check out an existing project按钮。

Then enter the details for the repository you want to access.

然后输入要访问的存储库的详细信息。

回答by Petr Javorik

For Xcode 9.4 and Git repository without *.xprojfile simple Source Control -> Clone...method doesn't work. Xcode just clones remote repository and opens it in Finder - no project is created nor opened.

对于没有*.xproj文件的Xcode 9.4 和 Git 存储库,简单的Source Control -> Clone...方法不起作用。Xcode 只是克隆远程存储库并在 Finder 中打开它 - 没有创建或打开项目。



Here is what worked for my remote C++ repository:

这是对我的远程 C++ 存储库有效的方法:

  1. $ git clone [your_repo.git]
  2. Create new project Shift + CMD + N
  3. Enable version control

    version control

  4. Now you should have cloned repo and new Xcode repo:

    new repo

  5. In your new Xcode repo remove all except *.xcodeproj

  6. In Xcode remove default Groups and Files (except Products):

    remove default groups and files

  7. Copy cloned repo content into new Xcode project directory:

    $ ditto [cloned_repo/] [new_repo/].

    Check that .gitdirectory was copied successfully.

  8. Add dirs and files into the project. Drag'n'drop them from Finder to your new Xcode project. Don't drag .gitand *.xcodeproj.

    drag'n'drop

    references

  9. Check branches and commit history:

    check version control history

  1. $ git clone [your_repo.git]
  2. 创建新项目Shift + CMD + N
  3. 启用版本控制

    版本控制

  4. 现在你应该已经克隆了 repo 和新的 Xcode repo:

    新的回购

  5. 在您的新 Xcode 存储库中,删除除 *.xcodeproj 之外的所有内容

  6. 在 Xcode 中删除默认组和文件(产品除外):

    删除默认组和文件

  7. 将克隆的 repo 内容复制到新的 Xcode 项目目录中:

    $ ditto [cloned_repo/] [new_repo/].

    检查该.git目录是否已成功复制。

  8. 将目录和文件添加到项目中。将它们从 Finder 拖放到新的 Xcode 项目中。不要拖拽.git*.xcodeproj

    拖放

    参考

  9. 检查分支和提交历史:

    检查版本控制历史

回答by UsamaAmjad

Since the answers are old, now there's an easier way to directly import/cloneproject into Xcode from Github and Bitbucket.

由于答案很旧,现在有一种更简单的方法可以项目从 Github 和 Bitbucket直接导入/克隆到 Xcode。

Bitbucket:Press Clone in Xcodebutton enter image description here

Bitbucket:Xcode 中的克隆按钮 在此处输入图片说明

Github:Press Open in Xcodebutton enter image description here

Github:在 Xcode 中打开按钮 在此处输入图片说明