1

I have run

git init
npm install --save-dev webpack

Then, there is a package.json and a node_modules directory in the root directory. I want to add the node_modules directory into git repo. After I run

git add .

There is no response any more. And I found the git.exe process occupy more and more memory usage , but there is not any response after several hours. What is wrong with it? Is it caused by pretty much files to be added into repo by git? How can I debug what happens in detail when that command is executed? Everything works fine if I just git add some other files/folder which is not node_modules. enter image description here

kidsit
  • 287
  • 3
  • 22

2 Answers2

1

Have you git init the repo folder? If yes, then you can run git status. There you should see any new or changed folder.

If node_modules is not mentioned, I guess you have a .gitignore file in your project folder. If you want to git add the node modules folder you will need to remove node_modules/ from .gitignore.

npm install --save-dev webpack will just add one more dependency in package.json and install webpack in your node local repo. This is not a git related command.

Check also this question: Git - Ignore node_modules folder everywhere

Hopfully this will help,

Gabi
  • 589
  • 3
  • 9
1

I figured out myself. This is caused by pretty much symlinks in the node_modules directory. If i evaluated the git-bash as administrator, the new installed node_module symlinks can be created as linux. And then when git add works well. Maybe, if without evaluated git-bash, git-bash can not create symlinks which cause pretty much files need to be git added, even worse maybe a circular reference between symblink and node module staff (not sure), that cause memory consumption of git increase always and no response. Hope it can help others if met the same problem on windows.

kidsit
  • 287
  • 3
  • 22