简体   繁体   中英

Removing large file from git repo, after the repo has been changed/deleted

I made a bit of a mess when I thoughtlessly tried to commit a large file to github. Now I can't commit anything because git still tries to add the file.

I'm getting the following:

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' 

Yesterday I tried to upload a large file to a repo called VR_video_test. The commit failed. I removed the video and tried again, deleting the repo and creating a new one called VR_video_test_no_video.

Now I'm noticing that I can't commit any more changes even when I'm in a totally different repo (as in the error noted above, I'm in a repository called WebGL-learning."

I deleted both VR_video_test repos from my local and remote repositories, so I don't understand why WebGL-learning thinks I'm trying to upload a video to VR_video_test.

Can anyone help me fix this?

I tried a few things: http://git-scm.com/book/en/v2/Git-Tools-Rewriting-History#The-Nuclear-Option%3a-filter-branch

Which yields the result:

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

I also tried:

git rm --cached VR_video_test/R0010508.MP4

git rm --cached VR_video_test_no_video/R0010508.MP4

git rm --cached R0010508.MP4

And I get the error:

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

I don't know how to fix this issue or how to even access the repos now that they're deleted.

Can anyone help?

Try first to clone git@github.com:johncap/webGL-learning.git, add a commit and push to see if the issue persists.

If it does (and the file isn't visible in the worktree), that would mean it is part of the history of the repo.
In that case, try the BFG repo cleaner in order to detect and automatically remove any large file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM