我的git推入卡在一个大文件中。该怎么办? [英] My git push is stuck on a large file. What to do?

查看:162
本文介绍了我的git推入卡在一个大文件中。该怎么办?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到一个致命的sha1错误。我相信它试图写大文件是卡住了。
我的状态表示我8提交。我试图将文件扩展名添加到排除文件夹中的忽略列表,但仍然卡住。我如何继续进行而不会丢失本地更改(除了大文件)?



我试过并且该捆绑包是巨大的〜650MB。

我不知道如何忽略以前未提交的提交文件。我可以在不丢失本地文件的情况下清除旧的提交吗?然后删除大文件然后再提交? 解决方案

From http://git-scm.com/book/en/Git-Tools-Rewriting-History


从每次提交中移除文件

这种情况发生得相当普遍。有人意外地提交了一个巨大的二进制文件与一个粗心的git add。,并且你想要在任何地方删除它。也许你意外提交了一个包含密码的文件,并且你想让你的项目成为开源代码。过滤分支是您可能想用来清理整个历史记录的工具。要从整个历史记录中删除一个名为passwords.txt的文件,可以使用--tree-filter选项来过滤分支:

$ git filter-branch --tree-filter'rm -f passwords.txt'HEAD


但是,如果它只是最后一次提交你搞砸了,你可以用 git rm large_file git commit --amend

I get a fatal sha1 error. I believe it is stuck trying to write large files. My status says I'm 8 commits ahead. I've tried to add the file extension to an ignore list in the exclude folder but it is still stuck. How do I proceed without losing my local changes (other than the large files)?

I've tried Predict how much data will be pushed in a git push and the bundle is huge ~650MB.

I don't know how to ignore the files from previous commits that were not pushed. Can I clear the old commits without losing the local files? Then delete the large files then commit again?

解决方案

From http://git-scm.com/book/en/Git-Tools-Rewriting-History :

Removing a File from Every Commit

This occurs fairly commonly. Someone accidentally commits a huge binary file with a thoughtless git add ., and you want to remove it everywhere. Perhaps you accidentally committed a file that contained a password, and you want to make your project open source. filter-branch is the tool you probably want to use to scrub your entire history. To remove a file named passwords.txt from your entire history, you can use the --tree-filter option to filter-branch:

$ git filter-branch --tree-filter 'rm -f passwords.txt' HEAD

But if it's only last commit you messed up you can solve it with git rm large_file and git commit --amend

这篇关于我的git推入卡在一个大文件中。该怎么办?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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