Git无法忽略Visual Studio中的节点_模块

Git无法忽略Visual Studio中的节点_模块,git,visual-studio,visual-studio-2015,npm,gitignore,Git,Visual Studio,Visual Studio 2015,Npm,Gitignore,下面是一个场景,我的同事已经将node_modules文件夹从他的机器推送到远程repo 在我的机器上,我运行了“npm_安装”来安装所有必需的依赖项。现在,当我尝试与远程回购同步以获取新更改时。我得到这个信息: Cannot pull because there are uncommitted changes. Commit or undo your changes before pulling again. See the Output window for details. 在更改选

下面是一个场景,我的同事已经将node_modules文件夹从他的机器推送到远程repo

在我的机器上,我运行了“npm_安装”来安装所有必需的依赖项。现在,当我尝试与远程回购同步以获取新更改时。我得到这个信息:

 Cannot pull because there are uncommitted changes.
 Commit or undo your changes before pulling again. See the Output window for details.
在更改选项卡中:包括我的节点\模块目录。所以,我需要忽略它

我尝试了以下方法:

  • 添加到tsconfig.ts:“排除”:[“节点模块”]
  • 在gitignore中添加了“node_模块”
  • 注意:节点模块目录位于Repo\Comaps\Compas\u ng\Compas\u ng文件夹中,该文件夹是解决方案中的web应用程序。gitignore文件位于父目录Repo\Compas中

    但是,当再次同步时,节点_模块仍显示在“更改”选项卡中


    我应该如何解决这个问题?以及为什么这些选项对我不起作用。

    您需要清理节点模块文件夹的缓存:

    git rm --cached -r node_modules