GitHub does not let me access Subfolders
GitHub has grayed out folders in my repo that I cannot access. This worries me, as my code changes are in those folders!
I am developing a ZF2 web application and using git for source control. ZF2 is modular, so somewhere somehow (most likely with composer.phar or possibly with git clone) I have downloaded some ZF2 modules into project subfolders. One such ZF2 module is
vendor/coolcsn/csn-user. I have made changes in that ZF2 module.
Problem 1: when I run git status, I get this:
$ git status # On branch master # Changes not staged for commit: # modified: vendor/coolcsn/csn-user (modified content, untracked content)
When I run git commit, it says “No changes added to commit”. And I’ve definitely made some changes.
So then I found that I can change my directory to
vendor/coolcsn/csn-user, and do git status and git commit there. Then I can change back to the root directory of the project, and do a git commit there. Then, all is fine…. until:
Problem 2: Until I do a git push to GitHub. On GitHub my entire project seems to be in place, but the
vendor/coolcsn/csn-user is not accessible on GitHub! It is Grayed Out. I cannot click on it. It makes me cry. I don’t know why and I don’t know what’s up. I’ve read something about git submodules. I don’t know if I have git submodules or if they are something else. I have not consciously set up any submodules myself. Either way, I am concerned that my GitHub submodule changes are not being tracked, or if they are being tracked, they are hidden, not accessible for viewing.
Possible Solution #1: I thought that I could REMOVE .git folder in the submodules (if they are submodules) and just do straight commits to GitHub, with my
csn-user folder possibly not being grayed out. But before I do so, I’ve heard that it is not advisable, and I wanted to check on what all that is going on, and how if anyhow, I can properly use git and GitHub and submodules, and track my changes at the same time.
In particular, looking for a set of steps, instructions, or ideas on how keep my repo accessible and committable both using git and GitHub.
One Solution collect form web for “GitHub does not let me access Subfolders”
You appear to be using submodules in your repository. Run
git submodule status to see the submodules in use.
“Problem 1”, your confusion around commits, is due to the difference between committing changes to the root repository vs to a submodule’s repository. It sounds like you are committing to a submodule repository and then updating the root repository to point its submodule at that new commit. This may be problematic if you are not publishing those commits because no one else will be able to find them should then checkout the root repository and want to fetch the submodules it depends on.
Github correctly does not show the contents of those directories because they are references to specific commits in other repositories, not part of the root repository itself.
While you could check all of these files into your root repository that does sound dangerous. by doing so you destroy information about where the contents of those subfolders came from. No one else (including you in the future) will be able to easily identify where that content came from or which revision you grabbed from those repositories.