·在部署时尝试“git clone”导致以下消息:
failed during stage 'preparing repo': Error checking out submodules:fatal: No url found for submodule path 'themes/ocean' in .gitmodules
·尝试“git submodule add”导致以下结果:
failed during stage 'building site': Deploy directory 'public/' does not exist
一个临时的解决方案似乎是删除主题中的 .git 文件夹,但是有更好的选择吗?
最佳答案
当存储库正在使用从另一个存储库克隆的文件,但没有到为其创建的源存储库的映射引用时,就会发生这种情况。映射需要添加到位于您正在使用的存储库根目录中的 .gitmodules
文件中。
要创建映射引用,请在您的 .gitmodules
文件中输入以下内容:
[submodule "path_to_submodule"]
path = path_to_submodule
url = git://url-of-source/
path_to_submodule
是您的存储库中将使用子模块的实际路径(相对于根目录),url-of-source
是包含子模块文件的原始存储库。
如果您可能希望从存储库中删除不需要的子模块,请在本地存储库中运行以下命令,然后将更改推送到远程:
git rm --cached path_to_submodule
path_to_submodule
是您的子模块的路径。
引用:https://www.deployhq.com/support/common-repository-errors/no-url-found-for-submodule
关于git - 尝试使用备用 hexo 主题时无法在 Netlify 上部署网站,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53625208/