我遇到了同样的问题(components/dashboard/js-dev/training/index.js 由于某种原因没有被跟踪),所以我做了以下操作:
$ git check-ignore -v components/dashboard/js-dev/training/index.js
$ (gave me nothing)
$ git check-ignore -v components/dashboard/js-dev/training/
$ /Users/User/.config/git/ignore:23: components/dashboard/js-dev/training/
无论如何,我觉得这很奇怪,所以我查看了这个文件,/Users/User/.config/git/ignore,它看起来是这样的:
(this is line 1)
# Automatically created by GitHub for Mac
# To make edits, delete these initial comments, or else your changes may be lost!
*.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
事实证明,第 23 行实际上是 .com.apple.timemachine.donotpresent 和 # Directories potentially created on remote AFP share 之间的那一行,换句话说,它是一个完全空的行!
我尝试删除所有额外的换行符,所以我的文件如下所示:
# Automatically created by GitHub for Mac
# To make edits, delete these initial comments, or else your changes may be lost!
*.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
我运行git status,我注意到它现在正在接收components/dashboard/js-dev/training/。我运行git add components/dashboard/js-dev/training/,一切正常。
希望这对某人有所帮助 - 这个问题让我陷入了不必要的长时间。