【问题标题】:Failing to push to GitHub (this exceeds GitHub's file size limit)推送到 GitHub 失败(这超出了 GitHub 的文件大小限制)
【发布时间】:2018-01-02 16:52:23
【问题描述】:

我的本​​地分支没有上传到 master,因为如错误输出所述,“downloads/ue4-test-8.zip 为 363.08 MB;这超出了 GitHub 的 100.00 MB 文件大小限制”我已经删除了这个文件,但是我所做的任何提交都会被拒绝。

  • 我已删除大文件。
  • 我认为一切都会好起来的,所以我向呼吸系统添加了新文件
  • 现在我在推送不存在的文件时遇到错误

我该如何解决这个问题并重新推送这个 repo?

这是我的输出日志:

~\Documents\GitHub\mryamz.github.io [master ↑6 +0 ~1 -0 !]> git push
Counting objects: 42, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (28/28), done.
Writing objects: 100% (42/42), 360.48 MiB | 668.00 KiB/s, done.
Total 42 (delta 18), reused 36 (delta 13)
remote: Resolving deltas: 100% (18/18), completed with 6 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: 92c21619bdc53df9a9cf2ed2b801c3d5
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File downloads/ue4-test-8.zip is 363.08 MB; this exceeds GitHub's file size limit of 100.00 MB
To https://github.com/mryamz/mryamz.github.io.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/mryamz/mryamz.github.io.git'
~\Documents\GitHub\mryamz.github.io [master ↑6 +0 ~1 -0 !]> cd downloads
~\Documents\GitHub\mryamz.github.io\downloads [master ↑6 +0 ~1 -0 !]> dir


    Directory: C:\Users\admin\Documents\GitHub\mryamz.github.io\downloads


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----        1/22/2017   4:58 PM          52509 Ampersand Studio v0.0.3.jar
-a----        1/11/2017   5:39 AM           3538 ascii_art .jar
-a----        7/26/2017   6:00 PM         133830 ClientSide.jar
-a----         3/3/2017   6:39 PM       69347251 Defend_The_Train.jar
-a----        1/11/2017   6:11 AM        2896549 Doppler_Effect.jar
-a----         1/9/2017   8:01 PM       10315457 friction_sim.jar
-a----        7/24/2017  11:45 PM         208804 jnativehook-2.1.0.jar
-a----        4/24/2017   9:15 PM         890923 Ludum_Dare_38.jar
-a----        4/23/2017   2:36 PM        1759272 Ludum_Dare_38_SRC.zip
-a----        5/12/2017  12:47 AM           6259 MBS.jar
-a----        2/18/2017   2:43 PM         226755 Pascals's Triangle.jar
-a----        2/18/2017   3:33 PM        1660624 Quadratic Calculator.jar
-a----        7/26/2017   5:27 PM          35977 RawPCM_Player.jar
-a----        1/11/2017   6:18 AM       10871259 Renassance v6.jar
-a----        2/16/2017   7:34 PM         116175 Scorched Earth.jar
-a----         5/8/2016   8:55 PM          18151 ServerSide.jar
-a----        7/26/2017   6:12 PM           9170 Simplix-Earth-Branch.jar
-a----        2/18/2017   2:38 PM          41453 Spirograph.jar
-a----        4/30/2017  12:44 PM         646609 sw.jar
-a----        1/11/2017   6:49 AM        1307614 Word Bank.jar


~\Documents\GitHub\mryamz.github.io\downloads [master ↑6 +0 ~1 -0 !]>

【问题讨论】:

  • 你在这里查看答案了吗stackoverflow.com/questions/33330771/…>?
  • 文件确实存在...在您的 Git 历史记录中。仅仅因为您当前删除了该文件并不意味着它不在历史记录中。故事的寓意:不要将大型二进制文件提交到您的存储库。

标签: git github git-push git-remote


【解决方案1】:

我认为你已经提交了这个文件。即使您删除该文件并进行新的提交,该文件仍会保留在先前的提交中。并且git push 将所有丢失的提交发送到远程。

您必须在推送之前重写 git 历史记录。如果没有git log,我无法为您提供确切的命令。 Squashing Commits 可以胜任。

【讨论】:

  • 那个链接帮我弄明白了。谢谢
【解决方案2】:

我通过以下方式解决了这个问题:

  1. git 存储
  2. git rebase -i
  3. 然后弹出一个文本编辑器,允许我在我需要删除的提交旁边写下术语“drop”。提交已成功删除。
  4. git 推送

【讨论】:

  • 在文本编辑器中,我将单词“pick”替换为单词“drop”
  • 在文本编辑器中写“drop”后如何“确认”?我一直按 Enter,但它对我不起作用。
  • @Liz 通常你按“esc”然后:wq 保存并退出编辑器然后按Enter。
【解决方案3】:

试试:

git filter-branch --tree-filter 'rm -rf path/to/your/file' HEAD
git push

【讨论】:

  • 他为什么要那样做?那有什么作用?它如何回答这个问题? How To Answer
  • git push 是不够的。我使用git push -f origin master 强制更新原点
猜你喜欢
  • 2015-09-29
  • 2016-01-24
  • 1970-01-01
  • 2020-02-26
  • 1970-01-01
  • 2020-04-22
  • 1970-01-01
  • 1970-01-01
  • 2021-01-24
相关资源
最近更新 更多