I'm not sure what I'm doing wrong in this case with my .gitignore file, but these files keep showing up.
Background
I'm using Jekyll to build a blog. Jekyll generates _site
and .sass-cache
directories when it begins serving.
I previously committed these directories before realizing I wanted to ignore them.
To be overly cautious, I added all of the following lines to my .gitignore
:
##Jekyll
/_site/
_site/
_site
/.sass-cache/
.sass-cache/
.sass-cache
Since I knew I'd committed these files previously, I:
- Committed the updated
.gitignore
file. - did a
git rm -r --cached .
- deleted the
_site
and.sass-cache
folders - ran a
git add .
andgit status
showed that the working directory was clean
Problem
Despite all of that, the updated .gitignore file, and verifying (I think?) that things are clean and good, whenever I run bundle exec jekyll serve
and jekyll generates the files, I see .sass-cache
and _site
show up in my untracked files.
Question
- What am I doing wrong here? Is my .gitignore formed improperly?
- How can I ensure that git never shows these directories in the untracked list?
The .gitignore in its current state can be found here.
Your
.gitignore
file is currently detected as UTF-16LE encoded. Changing encoding to UTF-8 is the solution.To fix:
Encoding
menu) to UTF-8 without BOMgit commit -m "fixed ignore file"
At this point, the ignore file should start working correctly.