在更改/删除存储库后,从git存储库中删除大文件

时间:2015-09-15 05:39:47

标签: git github version-control

当我不假思索地试图将大文件提交给github时,我搞得一团糟。现在我无法提交任何内容,因为git仍然试图添加文件。

我得到以下内容:

Counting objects: 39, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (39/39), done.
Writing objects: 100% (39/39), 262.40 MiB | 1.33 MiB/s, done.
Total 39 (delta 18), reused 0 (delta 0)
remote: warning: File VR_video_test/R0010508.MP4 is 60.67 MB; this is
 larger than GitHub's recommended maximum file size of 50.00 MB
remote: error: GH001: Large files detected.
remote: error: Trace: 8245456222332dd337864ff6a0c27870
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File VR_video_test/R0010508.MP4 is 263.34 MB; this
exceeds GitHub's file size limit of 100.00 MB
To git@github.com:johncap/webGL-learning.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@github.com:johncap/webGL-learning.git' 

昨天我尝试将一个大文件上传到一个名为VR_video_test的仓库。提交失败。我删除了视频并再次尝试删除了回购并创建了一个名为VR_video_test_no_video的新回复。

现在,我注意到即使我处于一个完全不同的回购中,我也无法进行任何更改(如上面提到的错误,我在一个名为的存储库中) WebGL的学习"

我从本地和远程存储库中删除了两个VR_video_test repos,因此我不明白为什么WebGL学习认为我尝试将视频上传到VR_video_test。

任何人都可以帮我解决这个问题吗?

我尝试了一些事情: http://git-scm.com/book/en/v2/Git-Tools-Rewriting-History#The-Nuclear-Option%3a-filter-branch

产生结果:

fatal: Not a git repository (or any of the parent directories): .git

我也尝试过:

git rm --cached VR_video_test / R0010508.MP4

git rm --cached VR_video_test_no_video / R0010508.MP4

git rm --cached R0010508.MP4

我收到错误:

fatal: pathspec 'VR_video_test/R0010508.MP4' did not match any files

我不知道如何解决此问题或如何在他们被删除后立即访问回购。

有人可以帮忙吗?

1 个答案:

答案 0 :(得分:1)

首先尝试克隆git@github.com:johncap/webGL- learning.git,添加提交并推送以查看问题是否仍然存在。

如果确实(并且文件在工作树中不可见),那就意味着它是回购历史的一部分。
在这种情况下,请尝试BFG repo cleaner以检测并自动删除任何大文件。