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

时间:2011-04-07 11:08:59

标签: 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)

运行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
#

正在运行git config -l显示:

core.excludesfile=/Users/Chris/.gitignore
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true

/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

1 个答案:

答案 0 :(得分:6)

尝试删除全局.DS_Store中的.gitignore后的问号?