0

I am trying to deploy some projects that I've built to GitHub. I am trying to deploy them using VS code. I prefer interfaces over commands (when it works right..).

So i'm initiating the git folder, but it doesn't create a gitignore file. So I create the file myself and of course write in it node_modules, then I am committing all changes (these are projects that are all done by now). When I deploy it though, the node_modules keep being deployed.

It all seems pretty straight forward, so I am not sure what am I doing wrong. I've create the gitignore file prior to my first and only commit and before any deployment ever occurred.

Edric
  • 24,639
  • 13
  • 81
  • 91
Tsabary
  • 3,119
  • 2
  • 24
  • 66
  • 3
    Did the content of `node_modules` in the repo exist before you added the `.gitignore`? The ignores don't remove existing content from the repo. – Richard Dec 20 '19 at 17:40
  • @Richard I've created a completely new repo just to deploy the project so no, it was completely empty before. I've also tried completely removing the repo from github, then committing another small change (unrelated, just some text change), then again deploying to a completely new repo, and node_modules show up again. – Tsabary Dec 20 '19 at 17:42
  • 2
    Does this answer your question? [How to make Git "forget" about a file that was tracked but is now in .gitignore?](https://stackoverflow.com/questions/1274057/how-to-make-git-forget-about-a-file-that-was-tracked-but-is-now-in-gitignore). Did you try [removing the file from cache](https://stackoverflow.com/a/1274447/5890227)? – Khalil Khalaf Dec 20 '19 at 17:58
  • It should be `.gitignore` (with a `.`) and it should be at the top/root folder. In VS Code, it should show the node_modules folder as grayed-out in the Explorer. – Gino Mempin Dec 20 '19 at 18:27
  • 1
    It sounds like you are just re-creating or re-pushing the repo in Github, but in your local copy the node_modules folder is already committed. Pushing basically copies the repo from your local to the remote (Github). It does not do anything with gitignore or tracking files. That's part of git commit. You need to untrack the node_modules folder and add it to gitignore before git commit. – Gino Mempin Dec 20 '19 at 21:49

0 Answers0