Deployment Failure - Adding submodule issues - Using Netlify

早过忘川 提交于 2019-12-24 00:26:30

问题


I am trying to deploy my site to Netlify, when I try to trigger deployment, I am getting this error:

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

My Folder directory is the one I want to deploy and these are the contents within that directory.

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

As you can see, the error is pointing to the startbootstrap-grayscale directory.

Within that startbootstrap-grayscale directory, everything you see above is within that same directory. (Not sure what I did there to have that happen). If I cd into the 2nd startbootstrap-grayscale directory, there is nothing inside of it.

I was told that I need to git submodule add <my github name> but am not sure what else to add in order to resolve this issue.

git submodule add -f asks for more info:

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>...]

Any suggestions as to what to add in order to fix this issue? Appreciate any help.


回答1:


I've had a similar issue in different projects a few times before. My solution was usually to decouple the submodule and move the code into my codebase (or using a managed package for this).

To decouple the module go into your submodule folder, delete the .git folder and add the files to your git repository. On the command line I would do it like this:

// 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 .

With these steps (and potentially minor tweaks to the paths) I've been able to resolve this issue for me.




回答2:


I was able to figure it out, I needed to get rid of my startbootstrap-grayscale folder by using rm -r startbootstrap-grayscale and pushing the changes. I had too many nested folders of the same type for some reason.



来源:https://stackoverflow.com/questions/55910066/deployment-failure-adding-submodule-issues-using-netlify

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!