前言GitHub仓库单个文件的推荐大小不能超过50MB(仅限于警告),但绝对不能超过100MB(拒绝提交)问题人总有手贱的时候,一不小心往Git仓库拷贝大文件并尝试push到GitHub,发现报错后才意识到问题这个时候无论怎么样push都不会成功的,即使用git执行delete操作也无济于事,因为改动记录保存在.git里边,有相关文件的历史版本记录解决方法一保证本地没有改动,使用git filter-branch删除git缓冲区里边的大文件gitfilter-branch--force--index-filter"git rm --cached --ignore-unmatch node_modules/puppeteer/.local-chromium/win64-686378/chrome-win/chrome.dll \ node_modules/puppeteer/.local-chromium/win64-686378/chrome-win/chrome_child.dll \ node_modules/puppeteer/.local-chromium/win64-686378/chrome-win/interactive_ui_tests.exe"--prune-empty --tag-name-filtercat----all然后强制推送到远程仓库,如果报错的话,可以试试方法二gitpush-f方法二通过python安装git-filter-repo包pipinstallgit-filter-repo强制删掉相关文件gitfilter-repo--pathnode_modules/puppeteer/.local-chromium/win64-686378/chrome-win/chrome.dll\>--pathnode_modules/puppeteer/.local-chromium/win64-686378/chrome-win/chrome_child.dll\>--pathnode_modules/puppeteer/.local-chromium/win64-686378/chrome-win/interactive_ui_tests.exe\>--invert-paths--force再次提交发现报错,大概是丢失remote的链接了于是乎,添加remote url绑定git remote add origin https://github.com/hywing/xxx.git再次强制推送就可以啦
前言GitHub仓库单个文件的推荐大小不能超过50MB(仅限于警告),但绝对不能超过100MB(拒绝提交)问题人总有手贱的时候,一不小心往Git仓库拷贝大文件并尝试push到GitHub,发现报错后才意识到问题这个时候无论怎么样push都不会成功的,即使用git执行delete操作也无济于事,因为改动记录保存在.git里边,有相关文件的历史版本记录解决方法一保证本地没有改动,使用git filter-branch删除git缓冲区里边的大文件gitfilter-branch--force--index-filter"git rm --cached --ignore-unmatch node_modules/puppeteer/.local-chromium/win64-686378/chrome-win/chrome.dll \ node_modules/puppeteer/.local-chromium/win64-686378/chrome-win/chrome_child.dll \ node_modules/puppeteer/.local-chromium/win64-686378/chrome-win/interactive_ui_tests.exe"--prune-empty --tag-name-filtercat----all然后强制推送到远程仓库,如果报错的话,可以试试方法二gitpush-f方法二通过python安装git-filter-repo包pipinstallgit-filter-repo强制删掉相关文件gitfilter-repo--pathnode_modules/puppeteer/.local-chromium/win64-686378/chrome-win/chrome.dll\>--pathnode_modules/puppeteer/.local-chromium/win64-686378/chrome-win/chrome_child.dll\>--pathnode_modules/puppeteer/.local-chromium/win64-686378/chrome-win/interactive_ui_tests.exe\>--invert-paths--force再次提交发现报错,大概是丢失remote的链接了于是乎,添加remote url绑定git remote add origin https://github.com/hywing/xxx.git再次强制推送就可以啦