1

The deal is: I've got a nodejs server in the root folder. There is also a git repo in the same place. Also I have a create-react-app in the folder of "client". The structure looks like this:

   /client
   server.js
   package.json

The problem is, when I push it to my github repo, the "client" folder content isn't getting added, I mean it stays empty having zero content inside, whereas there's supposed to be a react app in it. Can anybody help me to figure out, what's going on?

stahlhammer
  • 87
  • 1
  • 11
  • Did you ever `git add` the files inside `client/`? Is there any `.gitignore` in play? Have you checked your `git status`? – jonrsharpe Jul 04 '19 at 11:27
  • I tried `git add client/*` the response is `fatal: Pathspec 'client/*' is in submodule 'client'` – stahlhammer Jul 04 '19 at 11:40
  • So you have a git repo for the client, too. Is that what you want? – jonrsharpe Jul 04 '19 at 11:55
  • No, not actually. There initially was one (initialized by create-react-app), and I removed it. But the content in the "client" folder just doesn't get added to my repo. `git add .` doesn't work as well. And I only have 'node modules' in my .gitignore. – stahlhammer Jul 04 '19 at 12:16
  • https://stackoverflow.com/search?q=%5Bgit%5D+Pathspec+is+in+submodule – phd Jul 04 '19 at 12:18
  • Since I've ended up with same issue and same questions on stackoverflow couple of times I will give the solution in here: You need to remove all .git files recursively from top of your root folder by running this command "rm -rf .git". After that you need to re-initialize git as stated on github and all other sites. – Ardahan Kisbet Feb 19 '20 at 20:40

1 Answers1

0

Do the below steps, provided that you do not have entry of client folder in your .gitignore file.

1. git add .   // it is dot(.) actually
2. git commit -m "you commit message"
3. git pull origin your_branch_name  //If multiple people pushing to repo otherwise you can skip this step
4. git push origin your_branch_name
ravibagul91
  • 20,072
  • 5
  • 36
  • 59
  • This is the first thing I tried, and it doesn't help, the folder is still completely empty. – stahlhammer Jul 04 '19 at 12:17
  • Try `git status` after you push your code. and still you see some files then something might be blocking your files from adding like `.gitignore` file. – ravibagul91 Jul 04 '19 at 12:20