I git committed a large tar file (tens of GB). Oops. I then made a few more commits. I then tried to push to an existing remote repository on github of the simplest form (a single branch and I am the only user). Upon pushing I received the error:
Username for 'https://github.com': username
Enumerating objects: 77, done.
Counting objects: 100% (77/77), done.
Delta compression using up to 56 threads
Compressing objects: 100% (57/57), done.
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: the remote end hung up unexpectedly
Writing objects: 100% (58/58), 16.90 GiB | 75.81 MiB/s, done.
Total 58 (delta 25), reused 1 (delta 0), pack-reused 0
fatal: the remote end hung up unexpectedly
Everything up-to-date
But the repo is not up to date. I tried increasing the buffer following this question but the issue was not resolved. I probably shouldn't be trying to push a tens of GBs tar file and I should back it up elsewhere. I've since removed the large tar file from my local repo.
So I'd like to remove the commit where I committed a ridiculously large tar file but keep the other commits, and push again. I've scanned similar questions but I am overwhelmed by suggestions of reset
vs rebase
vs a plethora of other suggestions that I'm not adept enough with git to understand. How do I remove a commit from 5 commits ago, where I committed a ridiculously large tar file, while keeping the other commits to push?
$ git log
commit 157b030df1da4a02d0a9b4424e70dc1c4cf18eba (HEAD -> master)
Author: username
Date: Tue Nov 24 13:55:00 2020 -0600
Removed a directory
commit ba07a1e99d5702361e9b0a8c7441723e6ac82faf
Author: username
Date: Tue Nov 24 13:50:37 2020 -0600
Moved a directory
commit ccb3de003b05e83444416655eddbe83e3ff5b042
Author: username
Date: Tue Nov 24 11:19:53 2020 -0600
Modified a file
commit 1eff1c6f31f04bd02a536f3ef0ee9ff5e1681904
Author: username
Date: Tue Nov 24 11:18:25 2020 -0600
Modified a file
commit 69ee1de9a3e7fce35548e5d32cd168c32f0de945
Author: username
Date: Tue Nov 24 11:16:36 2020 -0600
Added a ridiculously large tar file
commit 8b70afae41f05c6108688c8ef1f987628d9fad82
Author: username
Date: Tue Nov 24 09:37:01 2020 -0600
Added a bunch of files