首页 > 解决方案 > .gitignore 即使在删除缓存后也不起作用

问题描述

我有一个问题要从我曾经尝试提交和推送的 git 跟踪中排除一个特定的目录,因为它包含一些太大而无法在 github 上推送的文件。

下面是目录结构。

/git_dir   
  └-foo
    └-.gitignore # "in which I only write '/_data/' "
    └-/_data
      └- XXX.tsv # a large file
    └- other files

我做了什么:

  1. 写了一个 .gitignore 来排除目标目录('/_data')
  2. 执行 git rm --cache -r 。
  3. 混帐添加。/ git commmit -m 'chore' / git push origin main

结果:

$git push origin main
>>remote: Resolving deltas: 100% (21/21), completed with 2 local objects.
remote: error: Trace: XXXXXX
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File
work/foo/_data/XXX.tsv is 185.07 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.

另外我实验性地删除了文件(XXX.tsv)并做了(1)-(3),没有任何改变。在我看来,以某种方式清理缓存效果不佳。你能告诉我是什么原因造成的,我该如何解决这个问题?谢谢你。

标签: gitgithubcachingcommand-line-interface

解决方案


推荐阅读