我试图将我的网站部署到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>...]
有关添加什么以解决此问题的任何建议吗?感谢任何帮助。
我以前在不同的项目中遇到过类似的问题。我的解决方案通常是解耦子模块并将代码移动到我的代码库中(或者使用托管包)。
要解耦模块,请进入子模块文件夹,删除.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 .
通过这些步骤(以及对路径的潜在微调),我已经能够为我解决这个问题。
我能够弄清楚,我需要通过使用startbootstrap-grayscale
并推动更改摆脱我的rm -r startbootstrap-grayscale
文件夹。由于某种原因,我有太多相同类型的嵌套文件夹。