Git出现 fatal: Pathspec 'xxx' is in submodule 解决方案

使用Yii Framework进行项目开发,在手动更新vendor的时候发现更新以后无法git add。

更新了七牛的SDK, 目录为vendor/crazyfd/yii2-qiniu, 下面有4个文件,

LICENSE Qiniu.php README.md composer.json

使用git status查看,没有任何提交,后手动删除重新copy了文件,再次使用git status:

modified: vendor/crazyfd/yii2-qiniu (modified content)

git add后只增加了文件夹,但是没有文件。手动Add:
git add vendor/crazyfd/yii2-qiniu/Qiniu.php

报出错误信息:
fatal: Pathspec 'xxx' is in submodule

解决方案

发现vendor/crazyfd下面并没有.git文件
所以使用下面命令:
git rm -rf --cached vendor/crazyfd/yii2-qiniu
git add vendor/crazyfd/yii2-qiniu/*

再次使用git status查看发现文件已经成功添加:
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
deleted: vendor/crazyfd/yii2-qiniu
new file: vendor/crazyfd/yii2-qiniu/LICENSE
new file: vendor/crazyfd/yii2-qiniu/Qiniu.php
new file: vendor/crazyfd/yii2-qiniu/README.md
new file: vendor/crazyfd/yii2-qiniu/composer.json

DONE

  • 6
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值