1

First and foremost, I am trying to have my azure app service host my create-react-app as well as use it to store my code, minus the node_modules. That said, I have started from scratch a few times after searching, asking here and elsewhere, but each time, when I go to push, somehow node_modules continues to persist in uploading itself.

My process has been:

git init, then touch .gitignore, with my .gitignore looking like:

# See https://help.github.com/ignore-files/ for more about ignoring files.

# dependencies
node_modules

# production


# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
package-lock.json

Then I do a git add ., then add my remote, then a git commit -m "", then a git push azure master, but regardless, "node_modules" continue to persist in being push. Why?

If I do a git status, you can see that it does not show the node_modules directory, so why does it continue to push it up? The image here shows the results of git status:

enter image description here

Again, I have done a complete reset 3-4 times with the issue being the same each and every time. You can see here where I thought I found resolution through another post, but despite these actions, still the same results. Should I do something else?

UPDATE:

Tried per the first answer, and all looks fine, but then it starts with the node_modules again. You can see what happens here in the screenshot:

enter image description here

Any ideas what is going on here with this? This initial built using the create-react-app and it seems something is happening when it hits the default scripts or something. Further ideas?

Mark
  • 1,812
  • 3
  • 29
  • 51

1 Answers1

1

First, to be sure, ignoring a folder should end with a /

node_modules/

If the git status does not show that folder, you can check if it is ignored with:

git check-ignore -v -- node_modules/a_file_within_node_modules

Second, make sure node_modules itself has no .git subfolder of its own.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • thanks. Checked and did all you suggested, but still get same results. Updated intial post with more info hoping to get closer to resolution! – Mark Feb 21 '18 at 06:06
  • @Mark Is the check-ignore result empty? – VonC Feb 21 '18 at 06:16
  • here is what I get with it: `git check-ignore -v -- node_modules/accepts/index.js .gitignore:4:node_modules/ node_modules/accepts/index.js` Though I am not sure if that is good or what. There are no git files within the `node_modules` folder either. – Mark Feb 21 '18 at 06:26
  • At least that folder is not added to the repo – VonC Feb 21 '18 at 06:37
  • If that one isn't being added, then in that theory, none of them should be added if all are added to the `.gitignore`, right? In doing this, is it possible that the `react-scripts` within the `package.json` is doing something to the `git push....`? – Mark Feb 21 '18 at 06:59
  • @Mark Yes, it is possible for the node_modules to be generated, following the specification in package.json. In other words, its presence on the remote side would not be related to git itself. – VonC Feb 21 '18 at 07:02
  • So then still no ideas on resolution? – Mark Feb 21 '18 at 07:25
  • @Mark No. But if that folder is generate instead of being pushed, that would explain what you see. – VonC Feb 21 '18 at 07:35