当前位置:   article > 正文

git提交超过文件限制的解决办法_文件内容超出页面提交上限,请在本地提交

文件内容超出页面提交上限,请在本地提交

git提交超过文件限制的解决办法

问题

remote: error: See http://git.io/iEPt8g for more information.
remote: error: File new-nsita/bitmap/bitmap.pdf is 189.85 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.
To https://github.com/wanqqq29/Daily-HTML.git
 ! [remote rejected] xxx -> xxx (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/wanqqq29/Daily-HTML.git'
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

报错信息中第三行提示文件太大

解决方法

  1. 查看是哪个文件超过限制
    • 第二行remote: error: File new-nsita/bitmap/bitmap.pdf is 189.85 MB; this exceeds GitHub's file size limit of 100.00 MB说明是bitmap.pdf这个文件太大,超过了100M的限制。所以我们就要处理这个文件了
  2. 重写commit,删除大文件
    • git filter-branch --force --index-filter 'git rm -rf --cached --ignore-unmatch new-nsita/bitmap/bitmap.pdf' --prune-empty --tag-name-filter cat -- --all注意将new-nsita/bitmap/bitmap.pdf替换成你的路径与文件
    WARNING: git-filter-branch has a glut of gotchas generating mangled history
        rewrites.  Hit Ctrl-C before proceeding to abort, then use an
        alternative filtering tool such as 'git filter-repo'
        (https://github.com/newren/git-filter-repo/) instead.  See the
        filter-branch manual page for more details; to squelch this warning,
        set FILTER_BRANCH_SQUELCH_WARNING=1.
    Proceeding with filter-branch...
    Rewrite 2621a6906cd6cf828ccf659622c8959c98e6eaab (3/5) (1 seconds passed, remaining 0 predicted)    rm 'new-nsita/bitmap/bitmap.pdf'
    WARNING: Ref 'refs/heads/master' is unchanged
    Ref 'refs/heads/xxx' was rewritten
    WARNING: Ref 'refs/remotes/origin/master' is unchanged
    WARNING: Ref 'refs/stash' is unchanged
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    看到第8行提示重写 说明成功
    不要忘了检查本地大文件还在不
  3. 强制推送修改后的repo
    • git push origin xxx --forcexxx是你当前的分支名
    • 可以看到成功推送
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/163210
推荐阅读
  

闽ICP备14008679号