Why can I not open my folder in GitHub?

GitGithub

Git Problem Overview


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?

Git Solutions


Solution 1 - Git

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?

Solution 2 - Git

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.

Solution 3 - Git

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

https://stackoverflow.com/questions/20412396/what-is-this-grey-git-icon

Solution 4 - Git

After you added a local folder:

  1. Remove .git folder inside of untracked submodule.
  2. Run git rm --cached . -rf inside the submodule, which was the key for me.
  3. git add . in parent or root folder and you are good to go.

Solution 5 - Git

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.

Solution 6 - Git

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

Solution 7 - Git

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!

Solution 8 - Git

This can happen when you initialize a repository in one of your 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 repository inside the src directory, and try pushing the changes again src would be available then.

Solution 9 - Git

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAnushkaView Question on Stackoverflow
Solution 1 - GitIvan ArackiView Answer on Stackoverflow
Solution 2 - GitTanishq VyasView Answer on Stackoverflow
Solution 3 - GitCodeWizardView Answer on Stackoverflow
Solution 4 - GitGiorgi GvimradzeView Answer on Stackoverflow
Solution 5 - GitTerchila MarianView Answer on Stackoverflow
Solution 6 - GitFabio PoloniView Answer on Stackoverflow
Solution 7 - GitAakanksha DuggalView Answer on Stackoverflow
Solution 8 - Gitreaped jugglerView Answer on Stackoverflow
Solution 9 - GitMrEpicView Answer on Stackoverflow