.gitignore is not working

Intellij에서 개발을 하는데 .gitignore에 추가한 파일들이 지속적으로 추적되었다. 그렇기에 푸쉬를 할 때마다 파일이 추가가 되었다.

 

이는 .idea에 파일이 추가되어 추적되기에 발생한 현상이었다. 캐시를 초기화함으로서 해당 문제를 해결하였다.

 

git rm -r --cached .
git add .
git commit -m "Fix untracked files"

 

출처

https://twpower.github.io/9-remove-gitignore-cache