简体   繁体   English

使用Git如何在提交时忽略node_modules

[英]With Git how ignore node_modules on commit

I'd like not commit the folder "node_modules" 我不想提交文件夹“ node_modules”

I tried several solutions found around the web : 我尝试了几种在网上找到的解决方案:

  1. Create a file .gitignore (placed in the route of my application at same level than .git folder) 创建一个文件.gitignore(放在我的应用程序的路由中,与.git文件夹位于同一级别)
  2. In this file I tried : node_modules and /node_modules/ and that /node_modules/** and that node_modules/** 在此文件中,我尝试了:node_modules和/ node_modules /以及那个/ node_modules / **和那个node_modules / **

When I do npm install this folder and all the packages are added to the file to commit and I get a warning from Visual Studio code because there are 5000 elements to commit. 当我执行npm install此文件夹,并将所有软件包添加到文件中以进行提交,并且由于存在5000个要提交的元素,我从Visual Studio代码中收到警告。

Any idea ? 任何想法 ?

创建一个.gitignore文件并添加node_modules/如果node_modules/添加到您的存储库,则您需要删除或.gitignote不起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM