I have a very basic github setup with a readme, a directory, and another directory inside it with an html file. On github I can only view the readme and the first folder but
For me, I had to commit the subdirectories which had .git
in it since both the parent and the subfolder have remotes to push to. And then commit and push the parent directory.
in my case, I needed a
git add files
git commit -am 'what I changed'
git push
the 'a' on the commit was needed.
Is week1
a submodule?
Note the relevant part from the output of the git status
command:
(commit or discard the untracked or modified content in submodules)
Try cd week1
and issuing another git status
to see what changes you have made to the week1
submodule.
See http://git-scm.com/book/en/Git-Tools-Submodules for more information about how submodules work in Git.
Believe this occurs because you have a child repository "submodule" that has changes which have not been staged and committed.
Had a similar problem, where my IDE kept reporting uncommitted changes, and running the stage (git add .
) and commit (git commit -m "message"
) commands had no effect. Thinking about this in hindsight, it's probably because the child repository had the changes that needed to be staged and committed, not the parent repository.
cd
into the submodule (has a hidden folder named .git
) and execute the commands to stage (git add .
) and commit (git commit -m "Update child repo"
)cd ..
back to the parent repo, and execute the commands to stage (git add .
) and commit (git commit -m "Update parent repo"
)sudo rm -Rf .git
== DO NOT USE THIS COMMAND == it permanently deletes submodule repository history (the purpose of GIT)git add -A
=== Added untracked files, but didn't fix issueWARNING! THIS WILL DELETE THE ENTIRE GIT HISTORY FOR YOUR SUBMODULE. ONLY DO THIS IF YOU CREATED THE SUBMODULE BY ACCIDENT. CERTAINLY NOT WHAT YOU WANT TO DO IN MOST CASES.
I think you have to go inside week1 folder and delete the .git folder:
sudo rm -Rf .git
then go back to top level folder and do:
git add .
then do a commit and push the code.
I was having the same problem. I ended up going into the subdirectory that was "not staged for commit" and adding, committing and pushing from there. after that, went up one level to master directory and was able to push correctly.