I pushed a folder to GitHub using 'git push' command. It is opening in my cloned directory. But when I try to access it on GitHub, it shows a different icon and doesn't open on clicking. Because of that, I am even not able to delete it. How can I fix this problem?
-
git only cares about files (not folders), what do you mean by "pushing a folder" ? – topheman Oct 13 '15 at 21:38
-
1@topheman, furthermore `push` operates on *commits*, not files _or_ folders. – ChrisGPT was on strike Oct 13 '15 at 23:08
-
Does the "other icon" look like a grey folder? – ChrisGPT was on strike Oct 13 '15 at 23:09
-
Your question makes it glaring obvious that you have no experience in git whatsoever. There is a large number of tutorials out there, most notably the [*Pro Git* book](http://www.git-scm.com/book/en/v2/Getting-Started-About-Version-Control) or the [interactive git tutorial](https://try.github.io/levels/1/challenges/1) from GitHub. You should take a look at these and try to understand the basics which should answer your questions perfectly. – Sascha Wolf Oct 14 '15 at 07:02
-
@topheman, it was a folder containing the source code that i committed and pushed. – Abhishek Garg Oct 14 '15 at 08:03
-
@melpomene, actually it is bitbucket repo and i can't give you access to it. – Abhishek Garg Oct 14 '15 at 08:03
-
@Chris, yes exactly there is a grey folder of somewhat different shape than the normal folder. When i try to open it by clicking on it in Github, it doesn't give any response. – Abhishek Garg Oct 14 '15 at 08:06
2 Answers
They grey icon you are seeing indicates a submodule:
Submodules allow you to keep a Git repository as a subdirectory of another Git repository. This lets you clone another repository into your project and keep your commits separate.
Submodules are often used for library code.
Based on your Bitbucket comment you are likely seeing this because you cloned another repository into your main one. Git repositories cannot be nested arbitrarily; there are extra workflow steps required.
It is possible to convert a submodule to a regular directory, but before you rush down that path you should take a few minutes to learn what submodules are and see if they might be a good fit for your use case. There are real benefits to using them (e.g. the ability to work on the inner and outer repositories while still being able to push
and fetch
with the upstream repositories).
It's worth noting that some developers strongly dislike submodules (though in many cases this can be linked directly to a misunderstanding of how they work). There are other tools that let you do similar things, e.g. git subtree
.
I think your next step should be to learn about your options (use submodules, use subtrees, or convert the inner repository into a regular directory). It's important to understand the tradeoffs of each before making a decision.

- 1
- 1

- 127,765
- 105
- 273
- 257
One of the directories in the repository contained a '.git' folder. This folder is created in a directory whenever you run 'git init' command in it. A Git repository inside a Git repository confuses the Git and such a behaviour takes place.

- 7
- 5