由于我已经删除的大文件无法推送到GitHub [英] Can't push to GitHub because of large file which I already deleted

查看:109
本文介绍了由于我已经删除的大文件无法推送到GitHub的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我有

Currently I have


  1. 清空GitHub回购

  2. SSH服务器回购(主) li>
  3. 本地回购

SSH服务器回购是最新的回购(生产站点)所以我从那里做了一个Git克隆到本地。然后我试着做一个 git push 给GitHub。

SSH server repo was the most up-to-date repo (production site) so I did a Git clone from there to local. I then tried to do a git push to GitHub.

一切都很顺利,但是它说了一些关于文件名的内容。 gz对于GitHub来说太大了。我不需要这个文件,所以我运行了几个Git命令从Git缓存中删除它,然后再推回SSH服务器。

Everything went OK but then it said something about filename.gz being too large for GitHub. I didn't need this file so I ran several Git commands to get rid of it from Git cache then pushed back to SSH server.

我没有看到大的虽然 git diff 不会返回任何内容,并且git push会返回一切都是最新的 - 即使文件不可见本地回购当我尝试推送到GitHub我仍然得到错误关于它
$ b

I don't see the large file locally but it's still on SSH server even though git diff returns nothing and git push returns "Everything is up-to-date" - And even though the file is not visible in local repo when I try to push to GitHub I still get error about it


远程:错误:文件fpss.tar.gz是135.17 MB ;这超过了GitHub的文件大小限制为100 MB

remote: error: File fpss.tar.gz is 135.17 MB; this exceeds GitHub's file size limit of 100 MB

我遵循解决问题中的步骤在GitHub帮助中列出,所以不应该这样做?

I followed steps under "fixing the problem" listed on GitHub help so shouldn't that have been enough?

是不是本地文件还是在git status / diff / push中列出的文件?

How is the file still in the ether when it's not local or listed in git status/diff/push?

推荐答案

您可以使用

git filter-branch --index-filter 'git rm -r --cached --ignore-unmatch <file/dir>' HEAD

这将删除该文件历史记录中的所有内容。问题在于该文件出现在历史记录中。

This will delete everything in the history of that file. The problem is that the file is present in the history.

这篇关于由于我已经删除的大文件无法推送到GitHub的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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