'GitHub: repository not pushing the folder created with create-react-app

I want to initialise a repository with the following folder structure.

main-folder
  |-- project_backend
  |-- project-frontend

Just for reference, the backend code is python and the frontend folder was created using create-react-app.

When I pushed the repo using GitHub desktop, the project-frontend folder wasn't published, it wasn't even committed in the initial commit.

I tried all possible ways of creating the repo, but this problem still persists.

Any suggestions would be welcome.



Solution 1:[1]

A couple things to check:

  • git will not commit empty folders
  • the .gitignore file may contain a pattern that excludes the folder

Solution 2:[2]

I too faced this problem. I use GitHub desktop. My folder structure was frontend folder inside backend folder. I had made the frontend first using create-react-app which created a commit and a .git folder.

I used this:

Delete the .git folder in your frontend folder.

It worked for me by simply doing this.

Solution 3:[3]

I had this issue, although with Node.js not python.

Create-react-app seems to automatically create a .git folder

Only way I found to fix it was to delete the .git folder in the frontend folder.

I went to the folder itself in Finder (Mac user) and Cmd + Shit + . to see hidden files and then deleted the .git folder

Waited a few minutes and then it loaded as it should.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Bill Jetzer
Solution 2
Solution 3 ShanSchrauwen