Not Able To Remove Submodule Gray Icon Folder From Git

Solution to Remove Submodule Gray Icon Folder from Git

If you are using Github to store or access your code then you might be faced this issue.

In this tutorial, I will provide you a solution to resolve the issue related to submodule gray icon directory from git repo.

When you have this issue, you will face below issues on a git repository.

1. You will find one of your directory changed and not accessible through git repo.
2. You will not able to add the same directory again using git add command.
3. You will not able to remove submodule gray icon directory from git repo.

I am posting this solution because the same issue I have faced with one of my GitHub repositories and after long hours of searching on the internet. I have found some safe steps to solve this issue.

You just need to perform below-provided steps one by one.

Step 1: Check Submodule status

A submodule allows you to keep another Git repository in a subdirectory of your repository. The other repository has its own history, which does not interfere with the history of the current repository. This can be used to have external dependencies such as third party libraries for example.

Below command provides you path of the subdirectory where .git directory available and because of this, you have faced this issue. With below command, we will check which subdirectory is not accessible from git repo.

With the following command, we will check which subdirectory is not accessible from git repo.

$ git submodule status
No submodule mapping found in .gitmodules for path 'sites/all/modules/drupalexp/modules/dexp_layerslider'

Step 2: Remove submodule from git cached

Once you get the output of submodule status. you need to perform below cached remove command which helps you to remove a submodule from git cached.

$ git rm --cached sites/all/modules/drupalexp/modules/dexp_layerslider

Step 3: Commit changes

Once you remove submodule directory from git cached. Run below command to commit the changes on git.

$ git commit -m "Remove submodule"

Step 4: Push Changes

Now push new changes on git repo which will delete or removed the submodule directory from git repo. Don't worry it will not harm you any other directory on the GitHub repo.

$ git push origin master

Step 5: Check git status

Now check git status you will find your directory which is not accessible from git repo comes under the untrack files section. You need to just add this directory once again using git add command then commit the new changes on git. Once you commit the changes run git push command which helps to push directory on git repo. Now check on GitHub repository you can able to access the directory without issues.

$ git status
$ git add sites/all/modules/drupalexp
$ git commit -m "drupalexp module add"
$ git push origin master

That's it. Now you will have your directory back to the GitHub repository. I hope this article will help someone who is struggling with this kind of issues. If you face any issue or having any doubt feel free to comment it under the comment box.

Read More :

Leave a Reply

Your email address will not be published. Required fields are marked *