I want to delete two files from my git repo that aren't there anymore.
I put them in, committed, and tried to push but they were too large. So I took them out, and kept working, then committed, tried to push, but it still gave me the same error. I figured they're still in the history somewhere.
I think I made the problem worse because I kept working in that branch and made 1 more commit. Then I merged that branch back to the master branch.
So I searched for a solution and found bfg.
But the instructions on the page don't make sense to me.
First off,
$ git clone --mirror git://example.com/some-big-repo.git
Where am I supposed to clone from? My remote repo on github.com doesn't have the commits and the merge I did since I added the large files. But the instructions make it seem like I'm supposed to get it from there anyway. (I cloned from my local repo.)
Next,
$ java -jar bfg.jar --strip-blobs-bigger-than 100M some-big-repo.git
Is some-big-repo.git
the mirrored repo or the normal local repo?
(I used the mirrored repo for this.)
And then I checked that my history had been updated and tried,
$ cd some-big-repo.git
$ git reflog expire --expire=now --all && git gc --prune=now --aggressive
(I was in the mirrored clone for this) I got an error.
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
remote: error:
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update its work tree to match what you pushed in some
remote: error: other way.
remote: error:
remote: error: To squelch this message and still keep the default behaviour, set
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To /home/cole/main_repo
+ 94b9a0d...c7c4317 work -> work (forced update)
! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to '/home/cole/main_repo'
This makes sense to me. Yeah I do currently have master
checked out. But then, what else was I supposed to do? I can only see problems happening if I try it another way.