【问题标题】:Deploy React app using with large files using GitHub Pages使用 GitHub Pages 使用大文件部署 React 应用程序
【发布时间】:2020-08-01 06:44:27
【问题描述】:

我遇到的问题是因为我使用了超过 100mb 的文件,这超出了 GitHub 的 100.00 MB 文件大小限制。我试图通过使用 Git 大文件存储来解决这个问题。我完成了这个过程,并且能够通过 Git LFS 跟踪文件:

$ git lfs track
Listing tracked patterns
   *.mov (.gitattributes)
   *.mov (.gitattributes)
   *.pdf (.gitattributes)

$ git lfs ls-files
cca18d4057 * build/static/media/BOL.6bcd7050.pdf
2af10f49e8 * build/static/media/DAOCCA.61340b94.pdf
6a0532b0cc * build/static/media/ebtms.4f75ae1c.pdf
f7ae820210 * build/static/media/tmsvideo.4967bd7f.mov
9e7d2e2bf5 * src/images/new/IMG_2156.MOV
1be822f20d * src/images/new/IMG_2248.MOV
f8fe209393 * src/images/new/IMG_2993.MOV
f7ae820210 * src/images/tmsvideo.mov
cca18d4057 * src/pdf/BOL.pdf
2af10f49e8 * src/pdf/DAOCCA.pdf
6a0532b0cc * src/pdf/ebtms.pdf

但是当我 yarn run deploy 时,我仍然收到和以前一样的错误:

$ yarn run deploy
remote: warning: File static/media/DAOCCA.61340b94.pdf is 85.94 MB; this is larger than 
GitHub's recommended maximum file size of 50.00 MB        
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - 
https://git-lfs.github.com.        
remote: error: Trace: d11b54c3460af3d02eb47c2fc15d64e1        
remote: error: See http://git.io/iEPt8g for more information.        
remote: error: File static/media/tmsvideo.4967bd7f.mov is 110.54 MB; this exceeds GitHub's 
file size limit of 100.00 MB

我将 React 应用程序部署到 GitHub Pages 没有问题;但是,当我尝试将它结合起来并利用 Git 大文件存储时,我没有成功。

非常感谢任何建议。

【问题讨论】:

    标签: reactjs git github-pages yarnpkg git-lfs


    【解决方案1】:

    GitHub Pages 不支持 Git LFS,因此如果您需要或想要将 Git LFS 用于您的存储库,则需要将其托管在其他地方。

    在一般情况下,您的问题是您的大文件位于存储库历史记录中的某个位置,您需要重写该历史记录以删除大文件。有关详细信息,请参阅the GitHub documentation on this。还有其他 StackOverflow 答案也可以解决这个问题。

    【讨论】:

      猜你喜欢
      • 2022-01-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-11
      • 2019-09-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多