【问题标题】:Why my app.component.html file is greyed out?为什么我的 app.component.html 文件是灰色的?
【发布时间】:2021-10-06 16:57:17
【问题描述】:

每次我初始化一个 Angular 项目时,我的 app.component.html 都是灰色的,并且在提交到 gitHub 时它总是被排除在外。

我认为这是因为 .gitignore 文件,就像 node_modules 文件一样,但我不确定是否是这种情况,因为没有提及在 .gitignore 文件中排除该文件。

我找不到这个问题的解决方案,手动将该文件上传到 gitHub 存储库真的很痛苦。为什么总是排除这个文件以及如何不排除它?

这是 Angular 项目中的 .gitignore 文件:

# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp
/out-tsc
# Only exists if Bazel was run
/bazel-out

# dependencies
/node_modules

# profiling files
chrome-profiler-events*.json
speed-measure-plugin*.json

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings

# System Files
.DS_Store
Thumbs.db

app.component.html 显示为灰色的图像。

【问题讨论】:

    标签: angular git github visual-studio-code


    【解决方案1】:

    如果它与您的 .gitignore 文件有关,您可以尝试使用 git check-ignore 来查看您的 app.component.html 是否符合您的某些限制,即使您不希望这样做。 使用方法请看这里:https://git-scm.com/docs/git-check-ignore

    【讨论】:

      【解决方案2】:

      不知何故,我发现我的 Mac 上的 gitignore_global 中有那个文件。

      我在这个 stackoverflow 问题中找到了解决方案: Where is .gitignore_global saved on OS X?

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-03-12
        • 1970-01-01
        • 2020-03-04
        • 2018-01-31
        • 2022-09-23
        • 1970-01-01
        相关资源
        最近更新 更多