Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何从已经从磁盘上删除的git树中删除文件_Git_Github - Fatal编程技术网

如何从已经从磁盘上删除的git树中删除文件

如何从已经从磁盘上删除的git树中删除文件,git,github,Git,Github,我尝试将数据推送到github,但出现错误 remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com. remote: error: Trace: 175fa38dfe7c67becde0232ae3469018 remote: error: See http://git.io/iEPt8g for more informa

我尝试将数据推送到github,但出现错误

remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: 175fa38dfe7c67becde0232ae3469018
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File Pods/FirebaseMLVisionTextModel/Frameworks/FirebaseMLVisionTextModel.framework/FirebaseMLVisionTextModel is 302.51 MB; this exceeds GitHub's file size limit of 100.00 MB
To https://github.com/paulo-bellator/MoneyFlow.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/paulo-bellator/MoneyFlow.git'

我删除了整个pod(通过重新安装pod),其中包含该文件。然后再试一次。 同样的错误

我试过了

git rm --cached "myFilePath"
但找不到文件

fatal: pathspec 'Pods/FirebaseMLVisionTextModel/Frameworks/FirebaseMLVisionTextModel.framework/FirebaseMLVisionTextModel' did not match any files
我也试过了

git commit --amend -CHEAD
得到这个回应。然后试图推,但再次得到相同的错误

MacBook-Air-Nikita:MoneyFlow nikitagoncharov$ git commit --amend -CHEAD
[master 65e9e7a] remove MLVisionTextRecognizing model
 Date: Wed Oct 9 13:57:22 2019 +0300
 30 files changed, 2965 insertions(+), 4612 deletions(-)
最后尝试了这个命令,但什么也没发生

git filter-branch
所以我仍然收到这个错误,无法推送我的数据

remote: error: GH001: Large files detected
如何从git中删除此文件,并最终将数据推送到github?

在中找到此解决方案

这里有很多答案,其中大多数对我来说都非常复杂(我是git的新手),但是这个解决方案看起来很简单,而且效果很好

解决方案:

git filter-branch --tree-filter 'rm -f file-to-be-removed-name' HEAD

这个文件是什么时候添加的(就git历史而言)?它是否在最新提交中?@sbat'Wed Oct 9 13:57:22 2019+0300删除MLVisionTextmodel@sbat“Sun Sep 29 00:47:50 2019+0300添加VisionExtRecognizer以解析屏幕上的操作”@sbat我在另一个分支上添加了此文件,并在那里停留了很长时间。几天前,我把那根树枝合并成了主人。并试图推动主,但它失败了,在这种情况下,我会支持上面的建议,使用过滤分支。您需要更改所有新提交,并从每个提交中删除此大文件。以上由@LasseVågsætherKarlsen链接的问题应该包括这一点。只需确保将带有此特定文件的原始提交传递给它(而不是全部),以确保只更改新提交(以防万一)。在这之前备份整个回购协议是个好主意。