删除git中缓存的大文件(文件名中带有空格) [英] Removing large files(with spaces in file name) that are cached in git

查看:204
本文介绍了删除git中缓存的大文件(文件名中带有空格)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试在git中提交更改时,出现以下错误

While trying to commit changes in git, I get the following error

remote: error: File folder/Unconfirmed 866711.crdownload is 486.30 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: GH001: Large files detected
![remote rejected] master -> master (pre-receive hook declined)

因此,我尝试使用给定此处

So, I tried removing the cached file using the command given here

git rm --cached "Unconfirmed 866711.crdownload"

git rm --cached "Unconfirmed\ 866711.crdownload"

但是,它不起作用

fatal: pathspec 'Unconfirmed\ 866711.crdownload' did not match any files

有关如何解决此问题的任何建议? 按照以下建议,我尝试了

Any suggestions on how to resolve this problem? Following the suggestions below, I tried

git filter-branch --force --index-filter "git rm --cached --ignore-unmatch folder/Unconfirmed 866711.crdownload" --prune-empty --tag-name-filter cat -- --all

我得到以下内容,

Rewrite 493310fe1e5fd4f06c9ee30b5b5157baae05358b (265/266) (181 seconds passed, remaining 0 predicted)
WARNING: Ref 'refs/heads/master' is unchanged
Ref 'refs/remotes/origin/master' was rewritten
WARNING: Ref 'refs/stash' is unchanged

在git过滤器之后,我从文件夹中删除了大文件并做了

Following git filter, I deleted the large file from the folder and did

git push origin --force --all

这将导致相同的错误

remote: error: File folder/Unconfirmed 866711.crdownload is 486.30 MB; this exceeds GitHub's file size limit of 100.00 MB

推荐答案

我试图遵循这个问题,似乎是因为文件很大.

I have tried to follow the question and seem like it is because of a large file.

我已经关注了一篇有关媒介的文章,希望对您有所帮助.

I have followed an article on medium, hopefully, it can be of help.

请找到据我了解,这是由于现在已跟踪文件而发生的,可以提供帮助的命令是: git filter-branch -f --index-filter'git rm --cached --ignore-unmatch fixtures/11_user_answer.json'

As per my understanding, this is happening since file is tracked now and command which can be of help is: git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch fixtures/11_user_answer.json'

这篇关于删除git中缓存的大文件(文件名中带有空格)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆