create-react-app git pushing node_modules

不羁的心 提交于 2020-01-16 09:07:42

问题


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:

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:

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

Further thoughts?


回答1:


/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.




回答2:


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?



来源:https://stackoverflow.com/questions/48468847/create-react-app-git-pushing-node-modules

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!