push on GitHub problem

Dear all,

sorry for this more or less unrelated post but I need help because I do not know what I should do. Thanks in advance…

I am doing an Udemy course using React and Django. I am done with the frontend part (React) and I want to push the code to GitHub. I am unable to do so. I do not know where to start and what information are important. Please do not hesitate to ask.

I created a Repo on GitHub (https://github.com/DoriDoro/UdemyCourse_Django_React_ecommerceApp) and push the code (I thought that I did that…)

Back to Visual Studio Code on iMac of 2011 I saw that there are still 24 untracked files.

in the terminal in VSC I checked the status (git status) result:

On branch master
Changes not staged for commit:
(use “git add < file>…” to update what will be committed)
(use “git restore < file>…” to discard changes in working directory)
(commit or discard the untracked or modified content in submodules)
modified: .DS_Store
modified: frontend (modified content, untracked content)

no changes added to commit (use “git add” and/or “git commit -a”)

So, I did in terminal:
git add .
git status

result:

On branch master
Changes to be committed:
(use “git restore --staged < file>…” to unstage)
modified: .DS_Store

Changes not staged for commit:
(use “git add < file>…” to update what will be committed)
(use “git restore< file>…” to discard changes in working directory)
(commit or discard the untracked or modified content in submodules)
modified: frontend (modified content, untracked content)

I do not know what I should do and for what I should search for in the internet to solve that issue.

Do I have to manually add all 23 files (with git add < filename> to commit them to GitHub?

It would be really great if someone can help me please. Thank you.

It could be difficult to help, without seeing files (how many files have been really pushed when you did the action?).
Maybe an app like GitHub Desktop can help you. It’s more practical to see conflits or “issues”.

Thanks for your answer. I am not sure what you mean with “It could be difficult to help, without seeing files…”

When I pushed to the Repo there was an actual folder visible: .DS_Store with no data inside and a kind of folder: frontend

pic of the Repo:
Screen Shot 2021-07-26 at 21.49.49

and on VSC there was this:

Thank you for the GitHub Desktop, I will have a lock and try it.

Is the above information helpful?

An other thing what I observed. I have an other project (React and Django project) with the same issue. For some minutes I removed the git remote with (git remote rm origin) and created a repo on GitHub to set a new git remote to the new created repo. The setting to the new repo was working fine and I could push the backend (Django) part without problem but the React part like in the above issue is not pushed and the same error occurs.

Perhaps I have done something in the React frontend folder which is not compatible with Git or GitHub. I have really no clue, as you can see. I am a beginner…


Ok, I think I understand now the issue. The frontend folder (first frontend folder, primary issue) is still connected to an other repo. That is so strange because I created the frontend-React-project from scratch with a new folder. I have not copy anything.

Is it possible that the frontend folder is connected to a repo even I have not connected it with a repo? I hope my thoughts are understandable…

I checked the frontend folder in terminal with the command: git remote -v
there was nothing displayed, NO ERROR like: fatal: “not a git repository (or any of the parent directories): .git”
it shows me just the terminal line: "iMac-de-admin:frontend admin$ " again


Screen Shot 2021-07-26 at 23.16.26

Yes, when downloading React it is immediately initializing a git repository.

I could find the issue. I asked at Stackoverflow:

https://stackoverflow.com/questions/68567868/react-project-difficulties-to-push-on-github

Really simple, there is a hidden .git folder inside of the React project folder. If you delete this .git folder (CAREFUL it is inside of the React folder, do not delete the .git folder inside of the root project folder) then you can push the code as usual. If you have already pushed the code to GitHub it is a different story but everything is possible to do.

I just think that answer could be interesting for all of you too.