为什么 git 查找我的主目录中不存在的目录?

why is git finding directories that don't exist in my home directory?

我正在运行在我的主目录中 Windows 10 上安装一个 git 存储库。当我 运行 git status、Git 发现我的机器上不存在的目录时:

warning: could not open directory 'AppData/Local/Application Data/': Permission denied
warning: could not open directory 'AppData/Local/ElevatedDiagnostics/': Permission denied
warning: could not open directory 'AppData/Local/History/': Permission denied
warning: could not open directory 'AppData/Local/Microsoft/Windows/INetCache/Content.IE5/': Permission denied
warning: could not open directory 'AppData/Local/Microsoft/Windows/INetCache/Low/Content.IE5/': Permission denied
warning: could not open directory 'AppData/Local/Microsoft/Windows/Temporary Internet Files/': Permission denied
warning: could not open directory 'AppData/Local/Temporary Internet Files/': Permission denied
warning: could not open directory 'Application Data/': Permission denied
warning: could not open directory 'Documents/My Music/': Permission denied
warning: could not open directory 'Documents/My Pictures/': Permission denied
warning: could not open directory 'Documents/My Videos/': Permission denied
warning: could not open directory 'Local Settings/': Permission denied
On branch master
Your branch is up to date with 'origin/master'.

上面的很多目录都不存在。为什么 Git 试图打开这些 不存在的 目录?

我的.git忽略:

#===============================================================================
# Blacklist everything, then whitelist sub-directories
#===============================================================================
# this allows me to whitelist individual FILES in sub-directories
*
!*/


#===============================================================================
# WHITELIST SPECIFIC THINGS
#===============================================================================
!.gitignore
!.bashrc
!.alias.sh
!.update.home.sh
!.startup.sh
!.todo
!dictionary.txt
!./.config/git/gitk
!Documents/ShareX/ApplicationConfig.json

An optional prefix "!" which negates the pattern; any matching file excluded by a previous pattern will become included again.

来自 gitignore 文档。

因此,如果我理解正确,您的行 !*/(黑名单区域的第二行)重新包含主目录中的所有目录,显然包括上述所有目录。

要显示主目录中的所有内容(还有 隐藏的 目录),请打开命令提示符 "Win" + "R",键入 cmd 并点击 "Enter".进入 dir /a,点击 "Enter",您会看到所有您想 do 的目录都显示在您的主目录中。