目录在github上显示为灰色文件夹,但不跟踪其内容。为什么?

问题描述 投票:7回答:4

我有一个目录“ui-kit”,它在github上显示为灰色文件夹。它不可点击。

Github screenshot

以下是.gitignore的全部内容:

# Fleetwit
docs
uploads/*
.env
*.prj
*.pui

# Logs
logs
*.log

#Node
node_modules

# =========================
# Operating System Files
# =========================

# OSX
# =========================

.DS_Store
.AppleDouble
.LSOverride

# Thumbnails
._*

# Files that might appear on external disk
.Spotlight-V100
.Trashes

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# Windows
# =========================

# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk

我试图检查为什么使用git check-ignore --verbose ui-kit忽略它但它没有返回任何东西。我尝试了git add的各种语法但没有成功。

该目录曾经是它自己的存储库,但是被移动到当前项目中并删除了所有原始的git文件和目录。

这是该目录的内容:

enter image description here

为什么github上的图标是灰色的?如何跟踪内容?

git github
4个回答
20
投票

感谢@Msp为我提供了我需要的信息:它被称为子模块。

谷歌搜索后,事实证明它只是需要重置的git缓存。

git rm --cached ui-kit

对于想要修复类似问题的人,您可以在以下主题中获取模式详细信息:un-submodule a git submodule


5
投票

因为,您已经创建了一个子模块。通常,子模块显示为绿色。但我假设它在你的情况下是灰色的,因为子模块配置不正确。由于.gitmodules不存在于您的仓库中,因此必须将其删除,从而留下没有远程信息的子模块。

阅读this答案了解更多详情..


3
投票

当您在该子目录中有.git目录时,也会发生这种情况。在您的情况下,您可能想要检查您的ui-kit目录是否包含它。删除.git目录,删除主.git目录,然后尽可能重新启动(git init)项目。这对我有用。


0
投票

如果您在此文件夹中初始化git,也会发生这种情况。要将更改目录修复到此文件夹并删除.git,然后再次add commitpush

© www.soinside.com 2019 - 2024. All rights reserved.