Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error after removing submodule: The following path is ignored by one of your .gitignore files:

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.

like image 756
zakdances Avatar asked Apr 02 '13 13:04

zakdances


People also ask

How to fix gitignore not working in GitHub?

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:

How to delete unnecessary submodule in Git?

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:

How to check what gitignore rule is causing a particular path?

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.

What is the use of Git ignore command?

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.


1 Answers

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.

like image 126
wkz Avatar answered Sep 23 '22 18:09

wkz