在执行git push时遇到大文件的问题

kpbwa7wx  于 2023-06-20  发布在  Git
关注(0)|答案(1)|浏览(201)

我尝试将我的本地项目(Linux)推送到我现有的GitHub存储库,但我收到以下消息:

Counting objects: 31, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (31/31), done.
Writing objects: 100% (31/31), 252.47 MiB | 2.14 MiB/s, done.
Total 31 (delta 21), reused 0 (delta 0)
remote: Resolving deltas: 100% (21/21), completed with 10 local objects.
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.

remote: error: Trace: f82a2261a9beaa11600c647fb5908566
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File merge.mp4 is 125.31 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File result_merge1.mp4 is 103.98 MB; this exceeds GitHub's file size limit of 100.00 MB

问题是,上述文件(merge.mp4和result_merge1.mp4)已被删除或在.gitignore文件中,因为我不想上传它们。
我试过看它们是否是神秘的,但它们不是。此外,我已经试图删除它们,但我得到一条消息,说它们没有在我的目录中找到。
有什么帮助吗?

jw5wzhpr

jw5wzhpr1#

如果它们曾经被添加,它们仍然会被跟踪,即使它们从未被推送到远程。将它们放在.gitignore中是一个很好的步骤,但是如果它们曾经被跟踪过,您也必须停止显式地跟踪它们。为此,请尝试git rm --cached merge.mp4
您还需要将其从存储库的历史记录中删除。把所有这些放在一起,你有一个像这样的命令:

git filter-branch --force --index-filter "git rm --cached --ignore-unmatch merge.mp4" --prune-empty --tag-name-filter cat -- --all

相关问题