I'm getting this error after I've removed a submodule. The path in question is not in my .gitignore file, nor is there anything relevant in my .git/info/exclude file. I don't have a .gitignore_global file. Why is git trying to ignore this path and how can I fix this?
The following path is ignored by one of your .gitignore files:
MyTest/MyTest/lib/submodules/ScreenRecorder
Use -f if you really want to add it.
This is the command I'm trying to execute:
git submodule add https://github.com/kishikawakatsumi/ScreenRecorder.git MyTest/MyTest/lib/submodules/ScreenRecorder
This is being executed from my git repos root directory.
In order to fix the .gitignore not working issue, it is necessary to have an overall understanding of gitignore. This issue often occurs when the .gitignore files can’t work in GitHub. GitHub (or Git) can view every file in your working directory that categories the files into the following 3 types:
Here is the step-by-step guide to delete the unnecessary submodule: To remove the entry in .gitmodules and remove the submodule directory located at path/to/submodule, you should invoke the following: [submodule "vendor"] path = vendor url = git://github.com/some-user/some-repo.git Next step is staging the changes via:
To check what gitignore rule is causing a particular path to be ignored, run git check-ignore: More info at man git-check-ignore. Show activity on this post.
Ignored: They are the files that can be set by users to ignore completely. The files that you want to ignore are tracked in a special file named .gitignore that you can check it in the root of your working repository. Based on the official documentation of GitHub, there is no specific gitignore command.
Removing the relevant [submodule]
stanza in my .git/config
solved the issue for me.
My guess that the superrepo will automatically ignore all files in submodules since they are not tracked. Therefore, if there is a stray [submodule]
stanza in your config, git will add the path as an ignore pattern.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With