栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

No submodule mapping found in .gitmodules for path ......

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

No submodule mapping found in .gitmodules for path ......

问题现象

在执行git submodule init 或 git submodule update的时候会报在map找不到路径的错误如下:

[root@centos7]#git submodule init
No submodule mapping found in .gitmodules for path 'thirdparty-tools/.github.com/gogo/protobuf'
问题原因

发现有工程里面,有不在 .gitmodule 文件中的 submodule 需要更新
通过如下命令查看

git ls-files --stage | grep 160000
[root@centos7]git ls-files --stage | grep 160000
160000 30cf7ac33676b5786e78c746683f0d4cd64fa75b 0	thirdparty-tools/.github.com/gogo/protobuf
160000 fd2d2c45eb2dff7b87eab4303a1016b4dbf95e81 0	thirdparty-tools/.golang.org/x/tools
解决方法

就是不在.gitmodule 文件中的 submodule删除掉,就是上面列出的路径
执行如下命令进行删除

git rm --cached path
#删除操作
[root@centos7]# git rm --cached thirdparty-tools/.github.com/gogo/protobuf
rm 'thirdparty-tools/.github.com/gogo/protobuf'
[root@centos7]# git rm --cached thirdparty-tools/.golang.org/x/tools
rm 'thirdparty-tools/.golang.org/x/tools'
# 再执行git submodule init 能成功
[root@centos7]# git submodule init
[root@centos7]# 

如果通过 git status能够查看删除操作

git status
....
# 要提交的变更:
#   (使用 "git reset HEAD ..." 撤出暂存区)
#
#	删除:      thirdparty-tools/.github.com/gogo/protobuf
#	删除:      thirdparty-tools/.golang.org/x/tools
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/841863.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号