Skip to content
Sign upLog in
← Back to Community

.gitignore is not ignoring files

Profile icon
Squirrel777

Ok so yesterday I asked on how .gitignore files work. So I made a .gitignore on my playground repl to test out the feature. But for some reason one of my files is not being ignored because it was already committed to! So I did git rm --cached ignore.js, and sure enough: it was still there. I also tried git rm -r --cached . with no success either. So does anybody know why this is happening? It works just fine for other files.

The point

.gitignore is not ignoring ignore.js, I tried git rm --cached ignore.js and git rm -r --cached ..

Github repo

Voters
Profile icon
Squirrel777
Comments
hotnewtop
Profile icon
SameeraMurthy

Problem
You can't ignore already committed files.

Solution
You can delete ignore.js in your GitHub repo, and in the repl try making some changes to the code, and commit + push again. It should be ignored.

Profile icon
SuperGamer1

Would like to bump this, as this is a big issue

Profile icon
IAmNew1234

مَا شَاءَ ٱللَّٰ
(Masha'Allah)
Masha'Allah, is an Arabic phrase that is used to express appreciation, joy, praise, or thankfulness for an event or person that was just mentioned. It is also a common expression used in the Muslim world to wish for God's protection of something or someone from the evil eye.
idk why i am commenting this

Profile icon
tussiez

@IAmNew1234
This doesn't answer the question?

Profile icon
IAmNew1234

ik sry

@tussiez

Profile icon
IAmNew1234

i just wanted to say it :D

@tussiez

Profile icon
tussiez
Profile icon
IAmNew1234
Profile icon
Coder100

You must delete the file first before the .gitignore things take place.
Even then, it's been a known bug replit doesn't accurately respect .gitignore

Profile icon
Coder100

If you already committed the file, it won't be ignored.

Profile icon
GatewayDuckYT

try using .replignore

Profile icon
GatewayDuckYT

@GatewayDuckYT
or .replit

Profile icon
Coder100

replit doesn't have ignore files
and .replit file is for running apps lol

@GatewayDuckYT