Git查看暂存区、清空暂存区、remote: error: GH001: Large files detected报错文件过大、忽略大文件

查看暂存区

git ls-files

从暂存区删除指定文件

git rm --cached <文件名>

清空暂存区的所有文件

rm .git/index

有时候明明暂存区里没有的大文件也会被上传,然后报错,今天被折磨了一个下午(꒦ິ^꒦ິ)。报错如下

remote: Resolving deltas: 100% (2/2), done.
remote: error: Trace: f51694da0a32cdb084515726bf3f6935d4394d73469ed193fcc16ee9a0a98757
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File data_stand.csv is 527.52 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
To github.com:xxxxxxxxx <my repository>.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'github.com:xxxxxxxxx <my repository>.git'

当时注意力全在 ! [remote rejected] master -> master (pre-receive hook declined)上,然后研究了好久gitlab和protected branch…如果是因为branch受保护没办法push可以参考这个:https://stackoverflow.com/questions/28318599/git-push-error-pre-receive-hook-declined

然后才发现只是不知道为什么明明暂存区里没有的文件也被push了,解决办法就是把报错的data_stand.csv给忽略掉再push就好了(第二遍push可以用git push origin master -f强制push):

git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch data_stand.csv'
  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值