我对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
答案 0 :(得分:6)
尝试删除全局.DS_Store
中的.gitignore
后的问号?