[英]git still shows files as untracked despite .gitignore and rm -r --cached. What did I do wrong?
I'm not sure what I'm doing wrong in this case with my .gitignore file, but these files keep showing up. 在这种情况下,我不确定我的.gitignore文件出了什么问题,但这些文件一直在显示。
I'm using Jekyll to build a blog. 我正在使用Jekyll建立一个博客。 Jekyll generates
_site
and .sass-cache
directories when it begins serving. Jekyll在开始提供时会生成
_site
和.sass-cache
目录。
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
: 为了过于谨慎,我将以下所有行添加到我的
.gitignore
:
##Jekyll
/_site/
_site/
_site
/.sass-cache/
.sass-cache/
.sass-cache
Since I knew I'd committed these files previously, I: 既然我知道我之前提交过这些文件,我:
.gitignore
file. .gitignore
文件。 git rm -r --cached .
git rm -r --cached .
_site
and .sass-cache
folders _site
和.sass-cache
文件夹 git add .
git add .
and git status
showed that the working directory was clean git status
显示工作目录是干净的 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. 尽管如此,更新的.gitignore文件,并验证(我认为?)事情是干净和良好的,每当我运行
bundle exec jekyll serve
和jekyll生成文件时,我看到.sass-cache
和_site
出现在我的未跟踪的文件。
The .gitignore in its current state can be found here . 可以在此处找到当前状态的.gitignore。
Your .gitignore
file is currently detected as UTF-16LE encoded. 您的
.gitignore
文件当前被检测为UTF-16LE编码。 Changing encoding to UTF-8 is the solution. 将编码更改为UTF-8是解决方案。
To fix: 修理:
Encoding
menu) to UTF-8 without BOM Encoding
菜单)更改为没有BOM的UTF-8 git commit -m "fixed ignore file"
At this point, the ignore file should start working correctly. 此时,ignore文件应该开始正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.