create-react-app git pushing node_modules

2019-08-17 19:40发布

So I am trying to push my initial commit using the create-react-app from a local git build. My .gitignore looks like such:

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

# dependencies
/node_modules

# testing
/coverage

# production


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

npm-debug.log*
yarn-debug.log*
yarn-error.log*

And my directory looks like this:

enter image description here

Left the directory structure the same by default, so why is it uploaded node_modules as well?

UPDATED INFO:

So revised that in my git ignore, but it seemed to have still pushed the `node_modules'. My git root is theapp > build / node_modules / public / etc... if that helps.

I went ahead and allowed it, but at the end of my push with git push azure master, I got this now:

enter image description here

Additionally, within windows, my file explorer looks like this:

enter image description here

Further thoughts?

2条回答
Ridiculous、
2楼-- · 2019-08-17 20:05

/node_modules is looking at the root of your computer.

What you want is node_modules/. Which looks for that directory relative to your current position.

查看更多
闹够了就滚
3楼-- · 2019-08-17 20:13

After you fix your .gitignore file, the directory still remains in the history. To permanently remove node_modules from the history, see How to remove/delete a large file from commit history in Git repository?

查看更多
登录 后发表回答