2017-03-07 55 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没有被跟踪。 –