gpt4 book ai didi

Git 无法忽略在全局忽略中定义的 .DS_Store

转载 作者:太空狗 更新时间:2023-10-29 12:54:09 26 4
gpt4 key购买 nike

我是 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

最佳答案

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

关于Git 无法忽略在全局忽略中定义的 .DS_Store,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5580097/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com