Reputation: 99
So, for whatever reason, empty folders were created around my repo after making a push to Github using Git Bash. I simply opened git bash and used the cd command until reaching my current repository on my local computer. Then, I pushed the repo. When looking on github, my directory structure now looks like this:
Documents
Visual Studio 2017
Projects
Repo folder
Repo Contents
etc..
Thankfully, I am able to just click on the outer folder one time and it takes me all the way inside Repo folder. However, this is confusing and unnecessary for my purposes, and I do not want to have to click on any folders to see the Repo contents. Is there a way to get rid of all of these empty outer folders so that I can just see the Repo Contents?
Edit after fix to potentially help others with the same problem: I was originally using CodeBlocks and then switched to Visual Studio by creating a new project and then copy and pasting the code. I pushed the repo in the new folder without doing a git init
. This left the .git folder in the CodeBlocks folder. If you change IDEs, be sure to do a git init
where the new files are located. It seems the folders all the way up to Documents were included in the repo push since this folder was the "least common" ancestor, so to speak, of both the old and new directory. It did not seem right when all the files in my computer's Documents directory showed up as unstaged files. Now I know why!
Upvotes: 2
Views: 986
Reputation: 83577
The directory structure you show is your repo, not just the single folder that you think it is. Somehow you created a repo in the Documents folder. Note that none of these folders is empty. They all contain exactly one folder up to Repo folder
. Since this isn't what you want, you need to start over. Delete your GitHub repo and the .git
folder from Documents. Then run Git Bash and cd
to the folder where you want the repo. Finally, run git init
.
Upvotes: 1
Reputation: 1328742
Check where you did initialize your local Git repo: where do you see a .git folder?
If you see it right under Document, that would be an error: delete it.
Then do a git init
in your Repo folder, add, commit, and push again.
Upvotes: 1