.gitignore - extra command so it doesn't push to github?
I have node_modules inside my .gitignore but it's uploaded to github anyway, googling it point me to .gitignore but if i already have that... am i missing something?
24 Replies
could be 2 things
1.- you are not setting it properly
2.- it was already included in a past commit before you had a gitignore
if it's already in a commit then even if you add it to gitignore it keeps uploading it
so you need to remove the file from git
so the file existed before I ever typed git init, so it should have recognized it.. anyway, to remove it am I just to rm --node_modules?
git rm --cached node_modules
fatal: not removing 'node_modules' recursively without -r
oh I always forget
git rm -r --cached node_modules
then is it a case of commiting and pushing without adding it?
boom, yeah done 🙂
no, gitiginore should work from now on, just double check that it is done correctly, I think it should just be
node_modules/
so inside .gitignore i have node_modules
db.sqlite
but yeah it was likely that you pushed it at some point before a gitignore and so you needed to remove from git cache
it should be
node_modules/
with the slash at the end
idk if it makes a difference but at least for readability that tells me that is a foldermakes sense, so if i were to git add . git commit and git push, it shouldn't push node_modules
in theory, not anymore no
you can check what is being added tho
git status -s
that's what I get now
i'll have to look into this one, as git add . is adding node_modules
🤔
show your gitignore
the .gitignore is in the same folder as node_modules yes?
it has to be something simple but because ive never done this (or havent in a year or 2), im not figuring it out 😄
until I figure it out ill just rm -r node_modules if i need to, but in future, is it as simple as git init -> git add -> git commit -> git push?
as in, I go in, write some code, save it, then follow the above ^ and voila, it's on github as an updated file
yes, well you do need to specify where it's going
but whenever you make a new repo it'll tell you how to set it up
after that you can just git add, commit, push
do i have to specify that every time I open the file on a new day, for example? or should it already be registered to my github, so it's just a case of pushing any updates?
once you git init and set the origin (github.com/blahblahblah.git) any future updates is just add,commit,push
gotcha
thanks for the help mate 🙂 I was genuinely losing my sanity haha
np
@erickohm .gitignore issue is because I created the gitignore file in cmd line on windows ,apparently saves it in the wrong UTF so deleted it, re-made it and it's now working 🙂
Wtf
Never would've guessed that
Thanks Windows
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View