See edit below
I'm trying to push to git, and then to heroku. However, I think that my push to git is being interupted because of the 'node_modules' folder.
The error I get: remote: error: GH001: Large files detected... To git@github...git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'git@github...git'
The large file is libsass.lib, which is within node_modules.
So I've added node_modules to my .gitignore file just like this:
node_modules/
And I've ran this command to remove node modules from the git push:
git rm --cached node_modules
git add .
git commit -am "Remove ignored files"
It says it works, but then I try and push again and get the same error.
What's my next step? Thanks a lot.
Edit. The duplicate question attached above did not help my problem. Here is what I did that eventually worked as I would expect.
I had 9 commits on my system that would not push, presumably because my first push failed. This will erase things, so backup your files. So I worked backward, removing them using:
git reset --hard HEAD~1 // Destroys the current commit, moving backward by one setp.
Once I made it to the start, I created my gitignore file for node_modules. Then I removed it's reference from git:
git rm -r --cached node_modules
git commit -m "remove node_modules"
git push origin master
My heroku instance was ahead in terms of commit, so I then forced a push to reset.
git push -f heroku
Now everything works again.