What does a grey icon in remote GitHub mean
Asked Answered
L

8

84

Can anyone please tell me why i have the grey icon when i push my files to github ? In side the app directory, there should be models, views , and controllers but in the remote GitHub I can't click in.

enter image description here

Leftist answered 25/10, 2013 at 7:57 Comment(0)
C
30

It looks like you created a submodule, pointing to an unreachable remote location.

See this answer. That icon, when green, will point to the sub module. I'm assuming it's greyed out in your case because the sub module was incorrectly configured.

Given that .gitmodules is not present, it must have been deleted, leaving a sub module without a remote information.

If go into app and type git remote -v you will see where this module is pointing too. This place is currently unreachable.

In a similar scenario, I added a submodule and deleted .gitmodules. The result on GitHub looks like this:

missing sub module

Chukker answered 25/10, 2013 at 8:45 Comment(9)
when i tried git submodule update --init it returns me no submodule mapping found in gitmodules for path 'app'Leftist
I tried git ls-tree --full-tree -r HEAD and it returns me 100644 blob 6628083525c40f2abab01a69c4599d38380b18a5 Rakefile 160000 commit 60b600031853f5f4bbc0a2885caf5085bbf873fc appLeftist
every directories are with the word blob except app ... n there isn't any further directory files in app... whereas in my actual project inside app, there is still a few directories like Model , View , Controller and etcLeftist
what does cat .gitmodules return? Do not post actual URLsChukker
cat: .gitmodules: No such file or directoryLeftist
.gitmodules was probably deleted. See updated answer.Chukker
the command git remote -v doesn't return me anything on the terminal :(... If gitmodules is delted what should i do ?Leftist
Hey Will thanks for the help =) .... Somehow playing around with git init after typing git remote getting no result i tried git init again from step1 and everything works fine now. THanks =)Leftist
What if the submodule was created unintentionally. How to fix the problem in that case?Abecedarian
V
76
git rm --cached <folder_name>

Then go to the parent directory and do:

git add .
git commit -m "<your_message>"
git push --all
Veiling answered 25/4, 2017 at 5:0 Comment(1)
Please note: --all pushes all branches.Bilection
C
30

It looks like you created a submodule, pointing to an unreachable remote location.

See this answer. That icon, when green, will point to the sub module. I'm assuming it's greyed out in your case because the sub module was incorrectly configured.

Given that .gitmodules is not present, it must have been deleted, leaving a sub module without a remote information.

If go into app and type git remote -v you will see where this module is pointing too. This place is currently unreachable.

In a similar scenario, I added a submodule and deleted .gitmodules. The result on GitHub looks like this:

missing sub module

Chukker answered 25/10, 2013 at 8:45 Comment(9)
when i tried git submodule update --init it returns me no submodule mapping found in gitmodules for path 'app'Leftist
I tried git ls-tree --full-tree -r HEAD and it returns me 100644 blob 6628083525c40f2abab01a69c4599d38380b18a5 Rakefile 160000 commit 60b600031853f5f4bbc0a2885caf5085bbf873fc appLeftist
every directories are with the word blob except app ... n there isn't any further directory files in app... whereas in my actual project inside app, there is still a few directories like Model , View , Controller and etcLeftist
what does cat .gitmodules return? Do not post actual URLsChukker
cat: .gitmodules: No such file or directoryLeftist
.gitmodules was probably deleted. See updated answer.Chukker
the command git remote -v doesn't return me anything on the terminal :(... If gitmodules is delted what should i do ?Leftist
Hey Will thanks for the help =) .... Somehow playing around with git init after typing git remote getting no result i tried git init again from step1 and everything works fine now. THanks =)Leftist
What if the submodule was created unintentionally. How to fix the problem in that case?Abecedarian
R
28

Git thinks it's a submodule as it has a .git directory inside it. To fix...

Changed directory to the offending dir:

cd <offending git submodule>

Remove the .git directory inside it:

rm -rf .git

Update the git cache:

git rm --cached <offending git submodule>

Go to the parent directory:

cd ..

Add the directory to git:

git add .
git commit -m "Changed submodule to directory"
git push --all
Ravo answered 20/12, 2018 at 10:47 Comment(6)
This saved me a headacheSandor
Great answer. Following these steps saved me a lot of confusion!Marcy
Great answer.This saved me from confusion!Berkly
This is by far the most correct answer after trying a couple of alternate answers. Thanks heapsKentledge
Should be the most upvoted. Just one thing, go to parent directory and then do git rm --cached <>Hedgehog
you saved my life..this the only solution that worked.Johnjohna
T
20

It looks like you initialized git inside the folder. Delete the git file (rm -rf) from the subfolder and create a new repo and re initialize git.

Tarry answered 20/10, 2015 at 5:43 Comment(1)
Very concise answer! I just went in, enabled hidden files, deleted the hidden git folder inside of my project, and re-uploaded -- the grey folders icon is now gone and all is good again on github. Thanks for the concise and straightforward answer.Goodhen
W
1

You have already initialized git inside the app directory and it can't find the remote. Delete the .git file inside app..

[app(master)]$ sudo rm -r .git

Or show the hidden files inside the folder and do it manually. Then re-commit & re-push the changes of the parent folder

Wickerwork answered 14/1, 2017 at 11:4 Comment(1)
<3 copy-paste answersWickerwork
E
1

The easiest method I found was simply to remove the folder from local and update the remote repo. Navigate to your local directory and cut the folder containing the incorrectly set up .git subfolder to another location (outside the local repo, eg desktop) so you can correct the issue and copy back in later, then run:

git submodule update

git add --all

git commit --all

git push

This should remove the folder that is greyed out on the remote repo. Then copy the folder back in again in your local files and run the add --all commit --all git push as above, taking care of course first to delete the incorrectly set up .git folder from the subfolder beforehand to avoid the same issue again; to locate this on linux systems use cntrl-h from within the folder to view hidden files in your folders, you'll see a .git folder present in a subfolder that is causing the issue, simply delete that and that should resolve

Eme answered 29/12, 2017 at 23:2 Comment(0)
R
0

It already has a .git inside it and hence appears grey. i.e it has git initialized inside it as well.

Resee answered 10/5, 2017 at 5:42 Comment(1)
In my case this was actually the problem as I had a .git folder inside the folder and then it seems to create a submodule automatically for the folder. I am not sure why this answer is marked down?Girardo
P
-1

In my case I had initialized a git repository in the root folder (the one that has manage.py) when deploying to Heroku before setting up a Git repository in the parent folder of the project.

When I then created a new repo in the project's parent folder, the root folder handling the models views and controllers was grayed out. The following worked for me:

  1. Delete parent folder repo
  2. Create new repo without checking "Initialize this repository with a README" since we will be importing the existing repository.
  3. Within your root folder the one with manage.py, do the following :

    git remote add origin "github repo link"

    git push -u origin master

  4. Refresh your Github repo and all your directories should be present
Pronominal answered 13/5, 2017 at 21:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.