从 Git 克隆后 XCodeproj 为空

XCodeproj empty after cloning from Git

我有一个使用两个库的 Swift 项目:SQLite 和 SwiftCSV 项目。它们可以分别在 https://github.com/stephencelis/SQLite.swifthttps://github.com/naoty/SwiftCSV 上找到。我按照每个 Github 自述文件的说明将项目合并到我的项目中,效果很好,但是当我将我的项目推送到 Github 并且我有另一个队友克隆该项目时, SwiftCSVSQLite 项目变成空的,所以我的队友必须将它们重新添加到他的项目中。我一直在尝试 google 不同的响应,但也许我正在寻找错误的关键字。关于如何解决这个问题有什么想法吗?

通常,xcodeproj 在 gitignore 中,请将其从 .gitignore 文件中删除

您应该(并且可能)将上述项目作为 submodules (if not, read up on them) 添加到您的存储库中。

如果您使用了子模块,则在您克隆存储库时不会自动检出它们。但是,您可以使用 clone--recursive 标志来确保在有人首次克隆您的项目时检出子模块:

git clone --recursive git@github.com:your/project.git

如果项目已经被克隆,可以通过 运行 从项目目录中执行以下命令来检查子模块:

git submodule update --init

Note: Xcode is usually smart about letting you check out submodules from within Xcode itself. Check the Source Control menu and see if SQLite.swift or SwiftCSV show up under Working Copies.

如果您只是下载项目并将它们拖到您的 Xcode 项目中(而不是使用子模块,如上文所述),它们可能会引用项目外部目录。确保先将它们移动到项目目录 ,然后再 将它们拖到 Xcode 项目中。如果不这样做,项目将出现在后续克隆中 red/unavailable。