在 .gitmodules 中找不到子模块路径 'Pods' 的 url

No url found for submodule path 'Pods' in .gitmodules

我已将 Xcode 项目添加到 git 存储库中。当我运行以下命令时:

$ git submodule init

我收到以下错误:

fatal: No url found for submodule path 'Pods' in .gitmodules

我没有添加 'Pods' 个子模块,它是自己添加的?

不确定为什么 Pods 列在您的 .gitmodules 中。 This article 提及

This occurs when the repository is using files cloned from another repository but has had no mapping reference to the source repository created for it.

The mapping needs to be added to a .gitmodules file located in the root directory of the repository you are using.

但在您的情况下,编辑 .gitmodules 文件并删除 Pods 条目。

然后检查你的索引中是否有 Pods:

git rm --cached -- Pods