300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > git remote: error: hook declined to update

git remote: error: hook declined to update

时间:2019-01-26 20:08:18

相关推荐

git remote: error: hook declined to update

今天git提交同步失败,报错如下

remote: error: File app/class_files.txt is 146.18 MB; this exceeds file size limit of 100.0 MB

remote: error: hook declined to update refs/heads/dev

! [remote rejected] dev -> dev (hook declined)

原来编译项目后无意中多了个文件class_files.txt,文件太大,超过git限制。

删掉本地文件,再推,还是报错。回滚,再推,还是同样的错误。

因为这个大文件在记录中已经存在,因此无论怎么删改,都不行的,所以要在日志中把这个文件删除即可。

网上搜到的有这样的命令

git filter-branch -f --prune-empty --index-filter ‘git rm -rf --cached --ignore-unmatch文件名’ --tag-name-filter cat – --all

我执行后是有问题的,报了这样一个问题

fatal: bad revision ‘rm’

后来又查找到一个命令

git filter-branch -f --index-filter “git rm -rf --cached --ignore-unmatch 文件名” – --all

执行后再push成功了

完成的解决步骤如下:

1、先执行

git ls-files

查看错误文件的完整路径

2、再执行下面的命令

git filter-branch -f --index-filter “git rm -rf --cached --ignore-unmatch app/class_files.txt” – --all

然后再Push即可。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。