hook declined to update refs/heads/dev


提交一個項目,push的時候,報錯:

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服務器對文件大小的限制。

刪掉本地文件,再推,還是報錯。加忽略文件,再推也是報錯。回滾,再推,還是同樣的錯誤。

最后發現是這個大文件已經保存到了log中,因此無論怎么刪改,這個文件沒有從log中剔除就總會報出相同的錯誤。所以要在日志中把這個文件刪除即可。

命令如下:

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

上面的xxx.rar就是上面上傳的大文件

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

上面的過程會很長,不要擔心,看見掃描的文件一個一個的變少,那就是離成功更近了。

最后再git push就好了


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM