hook declined to update refs/heads/dev

提交一个项目,push的时候,报错:git

warning: Large files detected.
remote: error: File TaodangpuAuction/TaodangpuAuction/AuctionClasses/Discover/TXLiteAVSDK/TXLiteAVSDK_UGC.framework/TXLiteAVSDK_UGC is 120.68 MB; this exceeds file size limit of 100.0 MB
remote: error: hook declined to update refs/heads/dev
To https://gitee.com/doubleyao1116/JianHuo.git
 ! [remote rejected]   dev -> dev (hook declined)
error: failed to push some refs to 'https://gitee.com/doubleyao1116/JianHuo.git'
bogon:每天鉴定dev mac$ 

缘由是有一个文件超过了git服务器对文件大小的限制。服务器

删掉本地文件,再推,仍是报错。加忽略文件,再推也是报错。回滚,再推,仍是一样的错误。this

最后发现是这个大文件已经保存到了log中,所以不管怎么删改,这个文件没有从log中剔除就总会报出相同的错误。因此要在日志中把这个文件删除便可。spa

命令以下:日志

git filter-branch -f --index-filter "git rm -rf --cached --ignore-unmatch xxx.rar" -- --all

上面的xxx.rar就是上面上传的大文件code

git filter-branch -f --index-filter "git rm -rf --cached --ignore-unmatch TaodangpuAuction/TaodangpuAuction/AuctionClasses/Discover/TXLiteAVSDK/TXLiteAVSDK_UGC.framework/TXLiteAVSDK_UGC" -- --all

上面的过程会很长,不要担忧,看见扫描的文件一个一个的变少,那就是离成功更近了。blog

最后再git push就行了rem

相关文章
相关标签/搜索