部署失败 - 添加子模块问题 - 使用Netlify

问题描述 投票:1回答:2

我试图将我的网站部署到Netlify,当我尝试触发部署时,我收到此错误:

1:46:02 PM: Error checking out submodules: fatal: No url found for submodule path 'startbootstrap-grayscale' in .gitmodules
1:46:02 PM: Failing build: Failed to prepare repo
1:46:02 PM: failed during stage 'preparing repo': Error checking out submodules: fatal: No url found for submodule path 'startbootstrap-grayscale' in .gitmodules

我的Folder目录是我要部署的目录,这些是该目录中的内容。

LICENSE             node_modules
README.md           package-lock.json
css                 package.json
gulpfile.js         scss
img                 startbootstrap-grayscale
index.html          vendor
js

如您所见,错误指向startbootstrap-grayscale目录。

startbootstrap-grayscale目录中,您在上面看到的所有内容都在同一目录中。 (不知道我在那里做了什么让这种情况发生)。如果我cd进入第二个startbootstrap-grayscale目录,它内部没有任何内容。

我被告知我需要git submodule add <my github name>但不知道还有什么可以添加,以解决这个问题。

git submodule add -f要求更多信息:

usage: git submodule [--quiet] add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [--] <repository> [<path>]
   or: git submodule [--quiet] status [--cached] [--recursive] [--] [<path>...]
   or: git submodule [--quiet] init [--] [<path>...]
   or: git submodule [--quiet] deinit [-f|--force] (--all| [--] <path>...)
   or: git submodule [--quiet] update [--init] [--remote] [-N|--no-fetch] [-f|--force] [--checkout|--merge|--rebase] [--[no-]recommend-shallow] [--reference <repository>] [--recursive] [--] [<path>...]
   or: git submodule [--quiet] summary [--cached|--files] [--su mmary-limit <n>] [commit] [--] [<path>...]
   or: git submodule [--quiet] foreach [--recursive] <command>
   or: git submodule [--quiet] sync [--recursive] [--] [<path>...]
   or: git submodule [--quiet] absorbgitdirs [--] [<path>...]

有关添加什么以解决此问题的任何建议吗?感谢任何帮助。

github deployment git-submodules netlify
2个回答
1
投票

我以前在不同的项目中遇到过类似的问题。我的解决方案通常是解耦子模块并将代码移动到我的代码库中(或者使用托管包)。

要解耦模块,请进入子模块文件夹,删除.git文件夹并将文件添加到git存储库。在命令行上我会这样做:

// going into the submodule - might need to tweaked, depending on the exact path
cd startbootstrap-grayscale

// delete the git submodule
rm -rf .git

// going out of the directory
cd ..

// adding everything to git
git add .

通过这些步骤(以及对路径的潜在微调),我已经能够为我解决这个问题。


0
投票

我能够弄清楚,我需要通过使用startbootstrap-grayscale并推动更改摆脱我的rm -r startbootstrap-grayscale文件夹。由于某种原因,我有太多相同类型的嵌套文件夹。

© www.soinside.com 2019 - 2024. All rights reserved.