Git:致命的:Pathspec在子模块中 [英] Git: fatal: Pathspec is in submodule

查看:2105
本文介绍了Git:致命的:Pathspec在子模块中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让TravisCI自动部署我的Hakyll静态网站,根据本指南



以下是我的回购协议的设置方法。我有我的源代码分支,其中包含我的hakyll和降价文件。它将HTML构建到 _site 目录中,该目录作为子模块建立,链接到我的 master 分支。 / p>

我在没有问题的情况下构建网站,然后将 cd 放入_site目录。但是,当我试图 git add ./* 新生成的HTML文件时,出现以下错误:

  fatal:Pathspec'./about.html'在子模块'_site'中

当我尝试 git add --all 时,出现此错误:

  git:pathspec.c:317:prefix_pathspec:断言`item-> nowildcard_len< = item-> len&& item->前缀< = item-> len'失败。 

/home/travis/build.sh:line 245:1566 aborted git add --all

是什么导致了这种情况,我该如何避免这种情况?



您可以查看存储库 here

  git rm --cached目录
git添加目录

如果您有意删除 .git 目录,因为您想要将目录添加到您的主要git项目中。在我的具体情况中,我让git克隆了一个扩展,并且运行 git add。而不用考虑太多。 Git决定创建一个我不喜欢的子模块。因此,我删除了 directory / .git ,并且碰到 Git:fatal:Pathspec位于子模块中。我无法找到如何删除子模块的东西。修正了上面的两行。


I'm trying to get TravisCI to automatically deploy my Hakyll static site, according to this guide.

Here's how my repo is set up. I have my source branch, which contains my hakyll and markdown files. It builds the html into the _site directory, which is set up as a submodule, linked to my master branch.

I build the site without problem, then cd into the _site directory. However, when I try to git add ./* the newly generated HTML files, I get the following error:

fatal: Pathspec './about.html' is in submodule '_site'

When I try git add --all, I get this error:

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

What is causing this, and how can I avoid this?

You can view the repository here.

解决方案

Removing the directory from git and adding it again worked for me:

 git rm --cached directory
 git add directory

This works if you purposefully removed the .git directory because you wanted to add directory to your main git project. In my specific case, I had git cloned an extension and ran git add . without thinking too much. Git decided to create a submodule, which I didn't like. So I removed directory/.git and ran into Git: fatal: Pathspec is in submodule. I couldn't find out how to remove the submodule stuff. Fixed with the two lines above.

这篇关于Git:致命的:Pathspec在子模块中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆