前言GitHub仓库单个文件的推荐大小不能超过50MB仅限于警告但绝对不能超过100MB拒绝提交问题人总有手贱的时候一不小心往Git仓库拷贝大文件并尝试push到GitHub发现报错后才意识到问题这个时候无论怎么样push都不会成功的即使用git执行delete操作也无济于事因为改动记录保存在.git里边有相关文件的历史版本记录解决方法一保证本地没有改动使用git filter-branch删除git缓冲区里边的大文件gitfilter-branch--force--index-filtergit 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再次强制推送就可以啦
阅读完成 · 觉得有帮助?