-2

I cloned a GitHub repository on my local machine using git clone and then made changes to it. I am now trying to upload the said repositroy to my Github but everytime I push it, rather than seeing the folders that it should contain I see this. enter image description here

I am unable to click the css-exercises folder. It only lets me click this "The Odin Project Flexbox Exercises." This is what happens when I try to push the repository css-exercises that I cloned from the Odin project and made changes to it. enter image description here

I just want to push the folder css-exercises.I have staged all the changes inside the css-exercises directory as you can see below. enter image description here

This is the status and log. enter image description here

I have tried the methods people described in this StackOverflow post and after following the most solutions the problem remains.

Please see this screen shot. I am unable to click the folder css-exercises. I can only click "The Odin Project Flexbox Exercises." enter image description here

git_gud
  • 595
  • 1
  • 10
  • 27
Ali Mustafa
  • 588
  • 1
  • 9
  • Have you tried following the instructions in the error message? It doesn't look like you have run `git pull` – evolutionxbox Dec 13 '21 at 14:56
  • I can see that `css-exercises` is pushed in the second screenshot, could you elaborate on the issue? – newt Dec 13 '21 at 15:10
  • I cannot click the css-exercises folder. It is not clickable but when I click "The Odin Project Flexbox Exercises" it takes me to the first screenshot. The folder css-exercises is indeed pushed but there are no files in it and it is not clickable. – Ali Mustafa Dec 13 '21 at 15:18
  • 3
    Note that Git never pushes *folders*, and never pushes *files*. Git doesn't store folders (at all), and while it does store files, it stores them in entities called *commits*. The `git push` operation sends the *commits* (which then carry the files with them in the process), but it's an all-or-nothing deal: you either send the whole commit (with all its files), or you don't send it. – torek Dec 13 '21 at 21:12

1 Answers1

0

The problem is that you messed up with your remotes. By default origin is your remote, but you added a new remote called css-exercises. You can see that also in your console when you ran git status

I'm pretty sure that if you run git remote -v the result will be something like

origin https://github.com/alimustafa-poder/Flexbox-CSS-Exercises (fetch)
origin https://github.com/alimustafa-poder/Flexbox-CSS-Exercises (push)
css-exercises https://github.com/alimustafa-poder/Flexbox-CSS-Exercises (fetch)
css-exercises https://github.com/alimustafa-poder/Flexbox-CSS-Exercises (push)

When you push your code try to do it with git push origin and you should see it working.
Note: now you have 2 remotes because you added one, but in general you can avoid specifying the remote you are pushing to.

git_gud
  • 595
  • 1
  • 10
  • 27