git 出现 fatal: Pathspec 'assets/' is in submodule 'public/components/clockpicker',解决方法

简述下出现的情况:
	1.之前从github上,clone了一个clockpicker的插件,然后,直接将整个版本库,复制到了项目中
	2.发现版本库中,并未记录到该目录!查看 '.gitignore' 等,也并未找到忽略该目录
	3.进入clockpicker目录下,发现有.git, .gitignore,因为原本就是完整的一个git仓库,猜想和这个有关,然后删除的只剩下 dist, src。然后 git status 查看,发现扔未记录
	4.强制 git add dist 目录,出现错误:
		fatal: Pathspec 'dist/' is in submodule 'public/components/clockpicker'
	5.google搜索:
		https://stackoverflow.com/questions/24472596/git-fatal-pathspec-is-in-submodule


原因解释:
	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.


	在我的主项目中,我clone一个git扩展,并运行了git add,并没有想太多。在这种情况下,git会创建一个子模块(也就是报错中的submodule),然后,就同我上面的第3步一样,将.git等等都删除了。然后运行git add 报错!
	-----------------
	不懂,反正大概意思了解就行,尽量不要在我们的项目中,再引入其他git仓库,我们自己都觉得不太对劲...


解决方案:
	git rm --cached clockpicker
	git add clockpicker才能够

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值