fatal: Pathspec 'autoload_classmap.php' is in submodule 'module/CocktailMakerModule'

StackOverflow https://stackoverflow.com/questions/23612012

  •  20-07-2023
  •  | 
  •  

質問

I have a repository on google code with my project.

I use Git source control.

It seems that when I try to add files to git from a specific directory, I get the following error:

fatal: Pathspec 'autoload_classmap.php' is in submodule 'module/CocktailMakerModule'

Now I'm not trying to add a submodule. I'm just trying to add a directory to git!

The result that I have now is that this directory is committed empty. So when I try to add specific files I get the above error message.

I checked and there isn't any other .git directory in that directory, so I'm really confused to why this has happened.

役に立ちましたか?

解決

Still no idea how it happened. All documentation I read assumes I have a .git directory there but I don't.

I just did the following:

git rm -rf --cached CocktailMakerModule/
git add CocktailMakerModule/

That seems to resolve the issue.

他のヒント

To remove unwanted submodule, you need to unregister it by:

git submodule deinit CocktailMakerModule

then re-add the directory or file again:

git add CocktailMakerModule

Check your current outstanding submodules by: git submodule status.

For further info, check the Git manual by running: man git-submodule.


Otherwise if you want to keep this submodule, please follow: Git: fatal: Pathspec is in submodule.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top