git 远程 GitHub 中的灰色图标是什么意思

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19584255/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 17:11:25  来源:igfitidea点击:

What does a grey icon in remote GitHub mean

gitgithubgithub-for-windows

提问by BC2

Can anyone please tell me why i have the grey icon when i push my files to github ? In side the app directory, there should be models, views , and controllers but in the remote GitHub I can't click in.

谁能告诉我为什么当我将文件推送到 github 时我有灰色图标?在 app 目录旁边,应该有模型、视图和控制器,但在远程 GitHub 中我无法点击。

enter image description here

在此处输入图片说明

采纳答案by Boj

It looks like you created a submodule, pointing to an unreachable remote location.

看起来您创建了一个子模块,指向一个无法访问的远程位置。

See this answer. That icon, when green, will point to the sub module. I'm assuming it's greyed out in your case because the sub module was incorrectly configured.

看到这个答案。该图标为绿色时,将指向子模块。我假设在你的情况下它是灰色的,因为子模块配置不正确。

Given that .gitmodulesis not present, it must have been deleted, leaving a sub module without a remote information.

鉴于它.gitmodules不存在,它一定已被删除,留下一个没有远程信息的子模块。

If go into appand type git remote -vyou will see where this module is pointing too. This place is currently unreachable.

如果进入app并键入, git remote -v您也会看到此模块指向的位置。这个地方目前无法到达。

In a similar scenario, I added a submodule and deleted .gitmodules. The result on GitHub looks like this:

在类似的情况下,我添加了一个子模块并删除了.gitmodules. GitHub 上的结果如下所示:

missing sub module

缺少子模块

回答by Ankit Agrawal

git rm --cached <folder_name>

Then go to the parent directory and do:

然后转到父目录并执行:

git add .
git commit -m "<your_message>"
git push --all

回答by Cockers

It looks like you initialized git inside the folder. Delete the git file (rm -rf) from the subfolder and create a new repo and re initialize git.

看起来您在文件夹中初始化了 git。从子文件夹中删除git文件(rm -rf)并创建一个新的repo并重新初始化git。

回答by sadfasdf

Git thinks it's a submodule as it has a .git directory inside it. To fix...

Git 认为它是一个子模块,因为它里面有一个 .git 目录。修理...

Changed directory to the offending dir:

将目录更改为有问题的目录:

cd <offending git submodule>

Remove the .git directory inside it:

删除里面的 .git 目录:

rm -rf .git

Update the git cache:

更新 git 缓存:

git rm --cached <offending git submodule>

Go to the parent directory:

转到父目录:

cd ..

Add the directory to git:

将目录添加到git:

git add .
git commit -m "Changed submodule to directory"
git push --all

回答by Simon Somlai

You have already initialized git inside the app directory and it can't find the remote. Delete the .git file inside app..

您已经在 app 目录中初始化了 git,但它找不到遥控器。删除应用程序中的 .git 文件。.

[app(master)]$ sudo rm -r .git

Or show the hidden files inside the folder and do it manually. Then re-commit & re-push the changes of the parent folder

或者显示文件夹内的隐藏文件并手动执行。然后重新提交并重新推送父文件夹的更改

回答by Leigh Mathieson

The easiest method I found was simply to remove the folder from local and update the remote repo. Navigate to your local directory and cut the folder containing the incorrectly set up .git subfolder to another location (outside the local repo, eg desktop) so you can correct the issue and copy back in later, then run:

我发现的最简单的方法就是从本地删除文件夹并更新远程存储库。导航到您的本地目录并将包含错误设置的 .git 子文件夹的文件夹剪切到另一个位置(本地存储库之外,例如桌面),以便您可以更正问题并稍后复制回来,然后运行:

git submodule update

git submodule update

git add --all

git add --all

git commit --all

git commit --all

git push

git push

This should remove the folder that is greyed out on the remote repo. Then copy the folder back in again in your local files and run the add --all commit --all git push as above, taking care of course first to delete the incorrectly set up .git folder from the subfolder beforehand to avoid the same issue again; to locate this on linux systems use cntrl-h from within the folder to view hidden files in your folders, you'll see a .git folder present in a subfolder that is causing the issue, simply delete that and that should resolve

这应该删除在远程存储库中变灰的文件夹。然后再次将文件夹复制回本地文件中并运行 add --all commit --all git push 如上所述,当然首先要注意事先从子文件夹中删除错误设置的 .git 文件夹以避免同样的问题再次; 要在 linux 系统上找到它,请使用文件夹中的 cntrl-h 查看文件夹中的隐藏文件,您将看到导致问题的子文件夹中存在一个 .git 文件夹,只需删除它即可解决

回答by nmal

It already has a .git inside it and hence appears grey. i.e it has git initialized inside it as well.

它里面已经有一个 .git ,因此显示为灰色。即它内部也有 git 初始化。

回答by Jennifer Paulino

In my case I had initialized a git repository in the root folder (the one that has manage.py) when deploying to Heroku beforesetting up a Git repository in the parent folder of the project.

就我而言,在部署到 Heroku 时,我在根文件夹(具有 manage.py 的文件夹)中初始化了一个 git 存储库,然后在项目的父文件夹中设置了一个 Git 存储库。

When I then created a new repo in the project's parent folder, the root folder handling the models views and controllers was grayed out. The following worked for me:

当我在项目的父文件夹中创建一个新的 repo 时,处理模型视图和控制器的根文件夹是灰色的。以下对我有用:

  1. Delete parent folder repo
  2. Create new repo withoutchecking "Initialize this repository with a README" since we will be importing the existing repository.
  3. Within your root folderthe one with manage.py, do the following :

    git remote add origin "github repo link"

    git push -u origin master

  4. Refresh your Github repo and all your directories should be present
  1. 删除父文件夹回购
  2. 创建新存储库而不选中“使用自述文件初始化此存储库”,因为我们将导入现有存储库。
  3. 带有 manage.py 的根文件夹中,执行以下操作:

    git remote add origin "github repo link"

    git push -u origin master

  4. 刷新你的 Github 仓库,你的所有目录都应该存在

回答by Del Ferns

Git thinks it's a submodule as it has a .gitdirectory inside it. To fix...

Git 认为它是一个子模块,因为它.git里面有一个目录。修理...

Changed directory to the offending dir:

将目录更改为有问题的目录:

cd <offending git submodule>

Remove the .gitdirectory inside it:

删除.git里面的目录:

rm -rf .git

Update the git cache:

更新 git 缓存:

git rm --cached <offending git submodule>

Go to the parent directory:

转到父目录:

cd ..

Add the directory to git:

将目录添加到git:

git add .
git commit -m "Changed submodule to directory"
git push --all