git上传忽略node_modules目录

在项目的根目录,右键选择 Git Bash 进入命令行;

在命令行输入:

touch .gitignore

生成 .gitignore 文件;

在文件中输入过滤信息,过滤规则如下:

node_modules/   表示过滤这个文件夹
*.zip   过滤zip后缀文件
demo.html   过滤该文件

我的项目中配置的是:

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

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

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

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

 

posted @ 2020-07-12 18:29  herry菌  阅读(394)  评论(0编辑  收藏  举报