2017-03-07 108 views
2

~/.config/git/ignore文件包括:爲什麼我的git忽略文件匹配xcuserdata?

xcuserdata/** 

我剛剛簽出,從到位桶一個新的項目,在Xcode中打開它,跑git status,它表明:

Untracked files: 
    (use "git add <file>..." to include in what will be committed) 

    Project Name.xcodeproj/project.xcworkspace/xcuserdata/ 

爲什麼沒有忽視與此目錄匹配的文件?

回答

1

首先,如果你想排除的文件夾,你並不需要「**

# The trailing slash is enough 
xcuserdata/ 

其次,檢查是否$XDG_CONFIG_HOME設置。
爲全球gitignore的默認路徑確實是(如果$XDG_CONFIG_HOME或者未設置或爲空)$HOME/.config/git/ignore

如果實在不行,直接設置它通過:

git config --global core.excludesFile /path/to/global/ignore/file 

discussion,該OP Vaddadi Kartick有刪除任何.git/info/exclude(其中有一個xcuserdata,沒有斜線)。
Vaddadi保留~/.config/git/ignorexcuserdata/,並且狀態現在忽略該文件夾。

+0

$ XDG_CONFIG_HOME未設置,並且xcuserdata仍顯示爲未跟蹤文件。我該如何解決? –

+0

@VaddadiKartick你有沒有在'xcuserdata'中跟蹤任何文件?嘗試一個'git rm --cached'閃存Camera.xcodeproj/project.xcworkspace/xcuserdata /「' – VonC

+0

它說:fatal:pathspec 沒有匹配任何文件。我在Bitbucket的網絡用戶界面上確認,xcuserdata沒有被跟蹤。 –