开发者

Git failing to ignore .DS_Store defined in global ignore

开发者 https://www.devze.com 2023-02-22 13:51 出处:网络
I\'m fairly new to git and hope I\'m not doing something terribly silly. I\'ve been living without a way of ignoring files in Git and have finally had my fill of accidentally adding OS files to my rep

I'm fairly new to git and hope I'm not doing something terribly silly. I've been living without a way of ignoring files in Git and have finally had my fill of accidentally adding OS files to my repositories.

I have a new git repository the git status of which is:

# 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)

Running git add . followed b开发者_StackOverflow中文版y git status produces:

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

Running git config -l shows:

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

The contents of /Users/Chris/.gitignore are:

# 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


Try removing question mark after .DS_Store in your global .gitignore?

0

精彩评论

暂无评论...
验证码 换一张
取 消