我正在尝试让 TravisCI 自动部署我的 Hakyll 静态站点,根据 this guide .
这是我的存储库的设置方式。我有我的源代码分支,其中包含我的 hakyll 和 Markdown 文件。它将 html 构建到 _site
目录中,该目录被设置为子模块,链接到我的 master
分支。
我毫无问题地构建了站点,然后 cd
进入 _site 目录。但是,当我尝试 git add ./*
新生成的 HTML 文件时,出现以下错误:
fatal: Pathspec './about.html' is in submodule '_site'
当我尝试 git add --all
时,我得到这个错误:
git: pathspec.c:317: prefix_pathspec: Assertion `item->nowildcard_len <= item->len && item->prefix <= item->len' failed.
/home/travis/build.sh: line 245: 1566 Aborted git add --all
是什么原因造成的,我该如何避免?
您可以查看存储库here .
最佳答案
从 git 中删除目录并再次添加它对我有用:
git rm --cached directory
git add directory
如果你故意删除 .git
目录,因为你想将 directory
添加到你的主 git 项目中,这将起作用。在我的具体案例中,我让 git 克隆了一个扩展并运行了 git add .
而没有考虑太多。 Git 决定创建一个我不喜欢的子模块。所以我删除了 directory/.git
并遇到了 Git: fatal: Pathspec is in submodule
。我找不到如何删除子模块的东西。用上面两行修复。
关于Git:致命:Pathspec 在子模块中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24472596/