Large file issue when pushing to GitHub persists despite not committing #1292
laurahspencer
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I ran into a very irritating issue when pushing local repo changes to GitHub, and am sharing with you all in case you also encounter it. Here's a narrative.
Some of my files saved locally to a git repo changed from being <100MB to >100MB, which means they were too large to push to GitHub. I didn't stage them for the commit (i.e. did not include them in my
git addcommand), but somehow after I committed and then pushed to github I encountered that large file error, keeping me from completing the push. I tried my typical tactics - which is to add those files to the .gitignore and undo the last commit viagit reset --soft HEAD~1, undo git add bygit reset, then re-add files individually to make sure I hadn't added large ones. This still didn't work. I then tried something new to try to remove the large files from all git history - which I do NOT recommend - usinggit filter-branchto delete all history of those large files. This created a HUGE issue - it essentially made a mirror of my repo that was ~330 commits ahead of the master, and to pull or push I needed to fix a bunch of merge issues. I think I neglected to do a follow-up command, which would have force pushed all my changes to the master, but in any case thegit filterwas not the route to go.I ultimately re-cloned the master to start fresh, and then found a solution 1) undo latest commit 2) then
git resetto unstage files, then 3) usegit rm --cached filexample.txtto remove each large file from git but retain the actual files (herecachedwas important, b/c it wouldn't let me do the removal otherwise since the files were also saved on the master).Hope this helps someone
Beta Was this translation helpful? Give feedback.
All reactions