How to Remove Submodule Gray Icon Folder From Git

Remove Submodule Gray Icon
Remove Submodule Gray Icon

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 the submodule gray icon directory from the git repo.

The issue’s faced due to Submodule on Git Repo,

1. You will find one of your directories 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 the submodule gray icon directory from the git repo.

I am posting this solution because I have faced same issue as 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 to “Remove Submodule Gray Icon”.

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 the path of the subdirectory where .git directory available and because of this, you have faced this issue.

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

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

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

Step 2: Remove Submodule From Git Cache

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/exp/modules/exp_slider

Step 3: Commit Changes

Once you remove the 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 remove the submodule directory from the 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 the GitHub repository you can able to access the directory without issues.

$ git status
$ git add sites/all/modules/exp
$ git commit -m "exp 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 issue.

If you face any issue or have any doubts feel free to comment on it under the comment box.

Read: Install and Configure Own Local GitLab server on Debian 8 Linux

Read: 5 Simple steps to transfer GitHub repository


Welcome to Linuxgrow. I'm Prashant, a tech-blogger from Mumbai, India. I started Linuxgrow as a passion and to share my knowledge about technologies. Here at Linuxgrow, I write about Linux technologies, Aws Cloud, Wordpress blogging and scripting knowledge. You can read more about me at About us page. Thank You :)

You may also like...

Leave a Reply

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