Git错误,需要删除大文件 [英] Git error, need to remove large file

查看:248
本文介绍了Git错误,需要删除大文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试推送到git时,我收到此错误,但我不知道如何解决.

I am getting this error when I try to push to git and I have no idea how to fix it.

Counting objects: 1239, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (1062/1062), done.
Writing objects: 100% (1239/1239), 26.49 MiB | 679.00 KiB/s, done.
Total 1239 (delta 128), reused 0 (delta 0)
remote: warning: File log/development.log is 98.59 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: efd2d13efa4a231e3216dad097ec25d6
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File log/development.log is 108.86 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File log/development.log is 108.74 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File log/development.log is 108.56 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File log/development.log is 106.58 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File log/development.log is 103.70 MB; this exceeds GitHub's file size limit of 100.00 MB
To git@github.com:myUsername/myRepo.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@github.com:myUsername/myRepo.git'

我猜我需要从提交中删除大文件,但是我该怎么做?

I'm guessing I need to remove the large file from the commit, but how do I do that?

推荐答案

要删除大文件,请GitHub

To remove large files, GitHub suggests:

$ git rm --cached giant_file
# Stage our giant file for removal, but leave it on disk

git commit --amend -CHEAD
# Amend the previous commit with your change
# Simply making a new commit won't work, as you need
# to remove the file from the unpushed history as well

git push
# Push our rewritten, smaller commit

或者,如果您想要更多有关工作方式的一般信息 GitHub上有大文件.

Or if you want more general information on how to work with large files on GitHub.

然后下次在.gitignore

这篇关于Git错误,需要删除大文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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