Git没有忽略全局忽略中定义的.DS_Store

Chr*_*son 8 git operating-system

我对git很新,希望我不会做一些非常愚蠢的事情.我一直没有在Git中忽略文件的方式生活,最终我不小心将OS文件添加到我的存储库中.

我有一个新的git存储库git status,其中包括:

# On branch master
#
# Initial commit
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   .DS_Store
#   README.markdown
nothing added to commit but untracked files present (use "git add" to track)
Run Code Online (Sandbox Code Playgroud)

运行git add .后跟git status产生:

# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached <file>..." to unstage)
#
#   new file:   .DS_Store
#   new file:   README.markdown
#
Run Code Online (Sandbox Code Playgroud)

跑步git config -l节目:

core.excludesfile=/Users/Chris/.gitignore
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
Run Code Online (Sandbox Code Playgroud)

内容/Users/Chris/.gitignore是:

# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so

# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip

# Logs and databases #
######################
*.log
*.sql
*.sqlite

# OS generated files #
######################
.DS_Store?
ehthumbs.db
Icon?
Thumbs.db
Run Code Online (Sandbox Code Playgroud)

Mic*_*ker 6

尝试.DS_Store在全球范围内删除问号.gitignore