代码之家  ›  专栏  ›  技术社区  ›  fourth

您的其中一个将忽略以下路径。gitignore文件

  •  19
  • fourth  · 技术社区  · 6 年前

    我试图添加文件夹 iceberg/static/icon 进入我的回购,但此操作失败并出现错误:

    shen-3:New Platform shen$ git add iceberg/static/icon
    The following paths are ignored by one of your .gitignore files:
    iceberg/static/icon
    

    这是我的。gitignore。我真的很困惑,我不知道哪个项目与我的文件匹配。

    hello/
    deploy_server/
    gunicorn_start
    Vida.env/
    
    # IDE conf
    .idea/
    .vscode/
    
    # Byte-compiled / optimized / DLL files
    __pycache__/
    *.py[cod]
    *$py.class
    
    # C extensions
    *.so
    
    # Distribution / packaging
    .Python
    env/
    build/
    develop-eggs/
    downloads/
    eggs/
    .eggs/
    lib/
    lib64/
    parts/
    sdist/
    var/
    wheels/
    *.egg-info/
    .installed.cfg
    *.egg
    
    # PyInstaller
    #  Usually these files are written by a python script from a template
    #  before PyInstaller builds the exe, so as to inject date/other infos into it.
    *.manifest
    *.spec
    
    # Installer logs
    pip-log.txt
    pip-delete-this-directory.txt
    
    # Unit test / coverage reports
    htmlcov/
    .tox/
    .coverage
    .coverage.*
    .cache
    nosetests.xml
    coverage.xml
    *.cover
    .hypothesis/
    
    # Translations
    *.mo
    *.pot
    
    # Django stuff:
    *.log
    staticfiles/
    local_settings.py
    migrations/
    
    # Flask stuff:
    instance/
    .webassets-cache
    
    # Scrapy stuff:
    .scrapy
    
    # Sphinx documentation
    docs/_build/
    
    # PyBuilder
    target/
    
    # Jupyter Notebook
    .ipynb_checkpoints
    
    # pyenv
    .python-version
    
    # celery beat schedule file
    celerybeat-schedule
    
    # SageMath parsed files
    *.sage.py
    
    # dotenv
    .env
    
    # virtualenv
    .venv
    venv/
    ENV/
    
    # Spyder project settings
    .spyderproject
    .spyproject
    
    # Rope project settings
    .ropeproject
    
    # mkdocs documentation
    /site
    
    # mypy
    .mypy_cache/
    

    发生这种情况还有其他原因吗?

    如果您能了解我的文件夹没有被添加的原因,我们将不胜感激!:) 非常感谢。

    所需的完整url /Users/shen/Desktop/New Platform/iceberg/static/icon

    6 回复  |  直到 6 年前
        1
  •  48
  •   jsageryd    6 年前

    检查什么 gitignore 规则导致忽略特定路径,请运行 git check-ignore :

    git check-ignore -v path/to/check
    

    更多信息,请访问 man git-check-ignore

        2
  •  6
  •   Steven Black    6 年前

    将以下行添加到 .gitignore

    !iceberg/static/icon
    

    爆炸(!)指将其包含在 。gitignore

    :)

        3
  •  5
  •   ErikMD    6 年前

    我不确定你的哪一行 .gitignore 触发忽略。

    但在这种情况下(默认情况下忽略文件,并且您仍然希望添加该文件),您始终可以执行以下操作:

    git add -v -f iceberg/static/icon
    

    这个 -f 标志是的快捷方式 --force
    (以及 -v 标志表示 --verbose ,这通常是使用 git add )

        4
  •  2
  •   daGo    5 年前

    我遇到过类似的问题,我就是这样解决的:

    很可能您有一个全球 .gitignore 文件可能位于 ~/.gitignore 。在你的 ~/.gitconfig 文件中有一行,如:

    [core]
      excludesfile = /home/userName/.gitignore
    

    从配置中删除该行可以解决上述问题。 让Git忽略跨 全部的 存储库您可以将行添加回全局 .gitconfig

        5
  •  0
  •   ZeZNiQ    3 年前

    在其他答案的基础上添加此答案,以防对某人有所帮助- 就我而言,我抱怨:

    The following paths are ignored by one of your .gitignore files:
    lol/foo/include
    lol/foo/baz/include
    

    我的gitignore拥有:

    include/
    

    正在从中删除该行。gitignore解决了我的问题。

    这告诉我即使你 违规路径 有一个 部分/子路径 到a 目录/子目录 在某处。gitignore,那么它也将被忽略。

    我检查了你的。gitignore文件。它不包含任何“冰山”或“静态”(虽然有“staticfiles/”,但这不重要)或“图标”。

    顺便说一句,您可能还想搜索中是否有其他“.gitignore”文件 任何 您当前的路径。gitignore。但我不能百分之百确定这是否真的是你的问题。

        6
  •  0
  •   senyonjo    2 年前

    我也遇到过同样的问题,我很容易就克服了,有一部分他们会告诉你-我猜,令人惊讶的是,它在终端类型中起了作用 git添加-f“路径”