您现在的位置是:首页 > 其他

李清波 2021-11-18 其他 873 复制当前网址

Git: fatal: Pathspec is in submodule

出现是问题:

git提交代码是出现fatal: Path 'directory/file' is in submodule 'directory''错误

 

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.


文章来源:https://www.liqingbo.com/blog-1783.html

评论