今天在git push的时候居然出现了一个自己从未见过的问题
error: hook declined to update refs/heads/detail-header
仔细阅读了下面一大段话
C:\Users\Administrator\Desktop\travel>git push
Counting objects: 47, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (44/44), done.
Writing objects: 100% (47/47), 347.23 MiB | 1.48 MiB/s, done.
Total 47 (delta 13), reused 0 (delta 0)
remote: Powered By Gitee.com
remote: warning: Large files detected.
remote: error: File src/assets/style/img/nox_setup_v6.3.0.6_full.exe is 348.04 MB; this exceeds file
size limit of 100.0 MB
remote: error: hook declined to update refs/heads/detail-header
To gitee.com:bangbangboom/travel.git
! [remote rejected] detail-header -> detail-header (hook declined)
error: failed to push some refs to '这里删掉不po出来了哈哈哈'
从里面提示的warning,error看就是有个文件台太大了啊喂
remote: warning: Large files detected.
remote: error: File src/assets/style/img/nox_setup_v6.3.0.6_full.exe is 348.04 MB; this exceeds file
size limit of 100.0 MB
里面这个“src/assets/style/img/nox_setup_v6.3.0.6_full.exe”文件已经超过了100.0MB了。
原来码云上不允许单文件超过100m,自己在提交的时候无意中加入了一个大文件,此时因为已经git 过,也commit了,如果你只是直接删除了那个文件是不起作用的,那个大文件已经保存在log中了,因此你需要删除掉的是rm
百度了大家就是用以下命令操作的
git filter-branch -f --index-filter "git rm -rf --cached --ignore-unmatch FOLDERNAME" -- --all
把命令行里面的 FOLDERNAME 替代成你那个要删除的文件
例如我的
git filter-branch -f --index-filter "git rm -rf --cached --ignore-unmatch **src/assets/style/img/nox_setup_v6.3.0.6_full.exe** -- --all
再重新push一下
问题解决嘻嘻~