.gitignore not ignoring _site folder in Jekyll site
xtoq opened this issue · 6 comments
Steps to reproduce
- Have a
.gitignore
file and a Jekyll site. - Ignore the
_site
folder inside the Jekyll site. - Run
jekyll serve
to build the site.
Expected outcome
- The
_site
folder and all subfolders/files should be ignored by Git.
Actual outcome
- The folder and all subfolders/files are not ignored, creating a PITA when trying to develop a Jekyll site.
- I've even tried ignoring the files specifically with no joy.
Additional Information
- This might be related to #1309 but my issue is not simply a UI bug.
- I haven't experienced this issue on other repos that are not Jekyll, but I haven't really looked into it. I can do that if you need.
- I'm on Windows 10, Brackets v1.70-16898, latest version of Brackets Git.
hi @xtoq
- open a terminal
- go to project dir
- execute
git status
and paste its result here please
I've even started a new Jekyll project, thinking that maybe there was something wonky in the one I was working on. This is based on Jekyll Blank, but the behavior is the same. As soon as jekyll serve
compiles the final files, Brackets Git shows that there are changed files in the _site
folder.
I'm on Windows 10, btw. Sorry for not providing that information before!
Here are the results of my git status
:
On branch dev-blank
Your branch is ahead of 'origin/dev-blank' by 4 commits.
(use "git push" to publish your local commits)
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: _site/index.html
no changes added to commit (use "git add" and/or "git commit -a")
Contents of my entire .gitignore
file:
_site
.DS_Store
.jekyll
.bundle
.sass-cache
Gemfile
Gemfile.lock
node_modules
package.json
# Jekyll stuff
/_site/
_site/
.sass-cache/
.jekyll-metadata
I've been doing some digging, and this happen in Atom too, which leads me to believe it's something with my .gitignore
file, but I'll be damned if I can figure out what. I tried changing the encoding of the .gitignore
based on the answer from this SO question but that didn't work either. Do you have any other suggestions of what might be the problem before I take the issue to the Git bug forum or the Jekyll one? Thanks in advance for your help.
I seem to have fixed the issue. I neglected to do the git rm -r --cached .
portion of the SO answer. After I ran that command, all the _site
folders and files disappeared from my git status
output (the encoding was unnecessary as they were already encoded correctly). What's weird though is that the .gitignore
with the _site
folder has been in the repo since the beginning, so I'm not sure exactly how the _site
files ever got added to the index to need to be removed in the first place...
Sounds more like a Jekyll thing and not a Git or Brackets (or Brackets Git!) thing. Hopefully this information might help someone else though!
I was going to close the issue, but thought I'd leave it open on the off chance there's something that needs to be done on the Brackets Git side. Thanks again for your help!
@xtoq you rock! Thank you for figuring this out. I have been sudo-manually removing _site/
from my commits. Also at least for me, I had to repeat git rm -r --cached .
for each branch I was working on. Hope this helps, best.
Does this mean the issue is closed?