我在~/Users/Tony/.gitignore_global
中創建了一個.gitignore_global文件,該文件也是存儲.gitconfig
的路徑。即使gitconfig指定絕對路徑,我的gitignore_global仍無法正常工作
這是什麼.gitconfig
內:
[core]
excludesfile = ~/.gitignore_global
這是什麼.gitignore_global
內:
# 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
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
# CocoaPods #
#############
Pods
# SVN #
#######
*.svn
.svn/*
# Xcode #
#########
build/
DerivedData
profile
xcuserdata
!default.mode1v3
!default.mode2v3
!default.pbxuser
!default.perspectivev3
*.mode1
*.mode1v3
*.mode2v3
*.moved-aside
*~.nib
*.pbxuser
*.perspective
*.perspectivev3
*.swp
*.xccheckout
我不明白爲什麼.gitignore_global
文件不能正常工作。這個.DS_Store
文件仍然被git檢測到。
我已經嘗試過像「git rm --cached .DS_Store
」這樣的評論,並嘗試了其他在Stack Overflow上找到的解決方案,但是git仍在檢測.DS_Store
文件。
我做了一個 「混帳配置 - 顯示,起源-l | grep的excludesfile」 和終端還給我 - 文件:在/ usr /本地/ GIT中的/ etc/gitconfig \t core.excludesfile =〜/的.gitignore - 文件:/Users/Tony/.gitconfig core.excludesfile =/Users/Tony/.gitignore_global下面有一個涉及「excludesfile」,這是否意味着它會覆蓋我的? –
@TonyOng這是一個好的開始。現在你可以做一些測試。 – VonC
我做了一些測試,但是.gitignore_global不起作用。我完成了你的第一點和第三點。不太明白第2點,但仍然運行命令並粘貼結果。嘗試運行點4,但它不工作。 –