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



我正在 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 试图打开这些不存在的目录?

我的 .gitignore :

#===============================================================================
# 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

一个可选的前缀"!",它否定了模式;任何被先前模式排除的匹配文件都将再次被包含。

来自 gitignore 文档。

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

要显示主目录中的所有内容(以及隐藏目录(,请打开命令提示符"Win" + "R",键入cmd并按"Enter"。进入dir /a,点击"Enter",您将看到您想知道的所有目录显示在您的主目录中。

最新更新