git - Git 忽略 .gitignore 文件并说 .DS_Store 文件已修改
问题描述
我不希望我的 MacBook 的 .DS_Store 文件被提交到我的 Git 存储库。
不幸的是,我的 .gitignore 甚至 .gitignore_global 似乎都被完全忽略了。
任何想法可能是什么原因?
ujjain:~/Dropbox/workspace| (HEAD) [+1] | feature/Jenkinsfile [+1]
$ cat .gitignore
...
# Mac OS Test
.DS_Store
ujjain:~/Dropbox/workspace| (HEAD) [+1] | feature/Jenkinsfile [+1]
$ git status
On branch feature/Jenkinsfile
Your branch is up to date with 'origin/feature/Jenkinsfile'.
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: .DS_Store
no changes added to commit (use "git add" and/or "git commit -a")
解决方案
您之前可能已经提交过此文件。试试这个来删除它:
git rm --cached .DS_Store
推荐阅读
- c++ - 使用 __block 时,clang BlocksRuntime 在可执行文件中嵌入“过时编译器”警告
- python - 第一次使用 XGBoost 回归器
- java - 有没有办法使用 Maven 来引用依赖项或 artifactItem 中的特定元素?
- node.js - 实施服务帐户密钥轮换的挑战
- snakemake - Snakemake:我可以在规则之外访问通配符吗?
- android - CardStackView 不能与 Scrollview 一起使用?
- python-3.x - 如何使用正则表达式从带有条件的字符串中提取特定值
- java - 如何在spring cloud gateway中设置超时?
- java - 用 Java 向电子邮件发送消息的程序
- html - 为什么网页手机双击按钮时页面会放大