【问题标题】:Greyed out folder in GitHub repo?GitHub 存储库中的灰色文件夹?
【发布时间】:2016-04-01 05:26:47
【问题描述】:

嘿,所以我将一个新文件夹推送到我的 GitHub 存储库,它是灰色的。为什么?

我是 git 新手,可能已经对 git 做了一些事情来导致这种情况,那么我该如何从头开始呢?

这是我的仓库的链接:https://github.com/ZoidinCode/ZoidinCode.github.io/tree/master/dist

我已经卸载了 Git 然后重新安装了它,这已经发生了:(

Git:

  cd desktop/Artificial-Reason-1.4.6
bash: cd: desktop/Artificial-Reason-1.4.6: No such file or directory

XXXX~/desktop/Artificial-Reason-1.4.6 (master)
$ git add dist/header_light_dark

XXXX ~/desktop/Artificial-Reason-1.4.6 (master)
$ git commit -m "First commit to GitHub"
[master 0e2035b] First commit to GitHub
 1 file changed, 1 insertion(+)
 create mode 160000 dist/header_light_dark

XXXX ~/desktop/Artificial-Reason-1.4.6 (master)
$ git push origin master
Counting objects: 1229, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (1223/1223), done.
Writing objects: 100% (1229/1229), 49.79 MiB | 443.00 KiB/s, done.
Total 1229 (delta 848), reused 0 (delta 0)
To https://github.com/ZoidinCode/ZoidinCode.github.io.git
 * [new branch]      master -> master

【问题讨论】:

  • 仍然卡住,因为我的 git 表现得很有趣,我什么也做不了,有什么帮助吗? @克里斯
  • “装腔作势”并不是一个很有用的描述。你能详细说明吗?重复问题中的答案有帮助吗?

标签: github


【解决方案1】:

GitHub 上的灰色文件夹看起来像 submodule,正如我在中提到的:

它不是子文件夹,而是the index 中的special entry,将其标记为类似子模块。

如果您的主存储库中没有 .gitmodules 文件,则该特殊条目通常是添加 嵌套存储库:检查您的 dist/ 文件夹本身是否具有 .git/子文件夹。

要解决此问题,请尝试使用 git rm --cached dist(没有尾部斜杠)。
在“Cannot remove submodule from Git repo”查看更多信息

git rm --cached dist
git commit -m "Remove submodule entry"
rm -Rf dist/.git # delete the nested repo
git add dist
git commit -m "Add dist plain subfolder"
git push

【讨论】:

    【解决方案2】:

    看起来你已经在这个文件夹中初始化了 git。将更改目录修复到此文件夹并删除 .git 然后删除 add commitpush 再次。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-04-02
      • 1970-01-01
      • 2021-05-13
      • 2017-11-29
      • 2021-03-11
      • 2016-06-13
      • 2022-01-09
      相关资源
      最近更新 更多