在 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
Import project from git in xcode
提问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 *.xproj
file 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++ 存储库有效的方法:
$ git clone [your_repo.git]
- Create new project Shift + CMD + N
Enable version control
Now you should have cloned repo and new Xcode repo:
In your new Xcode repo remove all except *.xcodeproj
In Xcode remove default Groups and Files (except Products):
Copy cloned repo content into new Xcode project directory:
$ ditto [cloned_repo/] [new_repo/]
.Check that
.git
directory was copied successfully.Add dirs and files into the project. Drag'n'drop them from Finder to your new Xcode project. Don't drag
.git
and*.xcodeproj
.Check branches and commit history:
$ git clone [your_repo.git]
- 创建新项目Shift + CMD + N
启用版本控制
现在你应该已经克隆了 repo 和新的 Xcode repo:
在您的新 Xcode 存储库中,删除除 *.xcodeproj 之外的所有内容
在 Xcode 中删除默认组和文件(产品除外):
将克隆的 repo 内容复制到新的 Xcode 项目目录中:
$ ditto [cloned_repo/] [new_repo/]
.检查该
.git
目录是否已成功复制。将目录和文件添加到项目中。将它们从 Finder 拖放到新的 Xcode 项目中。不要拖拽
.git
和*.xcodeproj
。检查分支和提交历史: