60

The "src" folder in one of my repository is grayed out (and is not clickable):

screenshot

I took the following steps before pushing to the GitHub:

  1. I created a new repository on GitHub.
  2. I initialize dthe git on my project.
  3. git add .
  4. git commit -m "comment"
  5. git remote add origin url
  6. git push -u origin master
  7. username
  8. password

The "src" folder is showing up on GitHub but cannot be opened. What can I do?

jub0bs
  • 60,866
  • 25
  • 183
  • 186
Anushka
  • 601
  • 1
  • 5
  • 4
  • Can you share a link to the relevant project? – Mureinik Feb 07 '15 at 16:29
  • If the last commit resulted in error, this might sometimes be the case. – Adi Feb 07 '15 at 16:54
  • There is only a single commit on github, are you sure you are on the master branch locally? – MrTux Feb 07 '15 at 17:11
  • 1
    possible duplicate of [What does a grey icon in remote GitHub mean](http://stackoverflow.com/questions/19584255/what-does-a-grey-icon-in-remote-github-mean) – jub0bs Feb 07 '15 at 17:11

11 Answers11

50

I solved the problem by deleting .git folder inside subfolders (Hidden files and folders). You should have only one .git in the root folder.

Git recognized that folder as modified but untracked content.
There are other solutions for this problem, look this thread: Git - how to track untracked content?

Ivan Aracki
  • 4,861
  • 11
  • 59
  • 73
26

There are two possible reasons to this

  1. You have a git folder within a git folder i.e. your src folder is a git folder itself. To fix that simply delete the .git folder within the src and
git add <foldername>
git commit -m "commit msg"
git push origin master

Incase if it still doesn't get fixed then, there maybe the problem because of cache. To fix that simple type

git rm --cached <foldername>

and repeat the above steps again. Your problem should get fixed.

Tanishq Vyas
  • 1,422
  • 1
  • 12
  • 25
22

After you added a local folder:

  1. Remove .git folder inside of untracked submodule.
  • Powershell: Remove-Item -Recurse -Force .\.git\
  • Linux Terminal: rm -rf ./.git
  1. Run git rm --cached . -rf inside the submodule, which was the key for me.
  2. git add . in parent or root folder and you are good to go.
Giorgi Gvimradze
  • 1,714
  • 1
  • 17
  • 34
11

The icon mean that you have marked this folder as submodule. open your .gitmodules and you will see there the folder named as src bin.

Remove them from your submodule and it will become a regular folder

What is this grey git icon?

Community
  • 1
  • 1
CodeWizard
  • 128,036
  • 21
  • 144
  • 167
7

I tried everything from above and nothing seemed to work in my case so I just renamed the trouble folder in something else then Github recognized it for some reason when I pushed the changes.

Terchila Marian
  • 2,225
  • 3
  • 25
  • 48
2

If you clone the project you will find, that these folders are in fact empty:

​$ ls -la bin
total 0
drwxr-xr-x+ 2 fabiopoloni  staff   68  8 Okt 12:18 .
drwxr-xr-x+ 8 fabiopoloni  staff  272  8 Okt 12:18 ..

​$ ls -la src
total 0
drwxr-xr-x+ 2 fabiopoloni  staff   68  8 Okt 12:18 .
drwxr-xr-x+ 8 fabiopoloni  staff  272  8 Okt 12:18 ..

There is also no .gitmodules so it'll show you an error when viewing the status / syncing it:

​$ git submodule status
No submodule mapping found in .gitmodules for path 'bin'

​$ git submodule sync
No submodule mapping found in .gitmodules for path 'bin'
No submodule mapping found in .gitmodules for path 'src'

Since they're empty, the easiest way is to delete them and commit:

​$ rm -rf bin
​$ rm -rf src
​$ git commit -a -m 'Removed empty submodules folders'
$ git push
Fabio Poloni
  • 8,219
  • 5
  • 44
  • 74
1

I encountered the same issue.

The command I gave was :

git add <foldername>

The problem here is we forgot to mention that we need this as a folder :

git add <foldername>/

With the backslash , we can now see that all the files of this folder are getting displayed and this works for me!

AS Mackay
  • 2,831
  • 9
  • 19
  • 25
0

This can happen when you initialize a repository in the child directories. For me, I'd initialized a git repo inside the client directory. In your case it might be the src directory, try rm -rf .git inside the src directory, this would delete the .git file inside the src directory, and try pushing the changes again src would be available then.

0

I had the same problem in my react folder but I had solved it by . . git rm --cached

MrEpic
  • 19
  • 2
0

Despite deleting the .git folder github did not add properly the affected folder. I did not want to delete the folder and I instead did the following:

I've solved it with the following order

In my example let's say that I've the following repo structure

app
| - .git # <- Correct .git of the repo
| - dir1
| - dir2
| - subApp
| ---
    | - .git # <- Mistake here because there was another .git
    | - subfolder1
    | - ....
| - dir 3 
 

Now with the followig structure and git with not allow you to push the content of the subfolder because it contains already a .git (in my case it was created by an automatic process)

Solution

  1. Remove the .git folder
rm -rf ./subApp/.git
  1. Rename subApp and push changes
rm subApp subAppTemp
  1. Add and push
git add subAppTemp
git commit -m "Temporary push"
git push 
  1. Rename it to original name and push back to git
rm subAppTemp subApp
git add subApp
git commit -m "Correct push of dir.."
git push
Federico Baù
  • 6,013
  • 5
  • 30
  • 38
0

Remove .git folder from client.

eglease
  • 2,445
  • 11
  • 18
  • 28