rtyley / bfg-repo-cleaner

Removes large or troublesome blobs like git-filter-branch does, but faster. And written in Scala
https://rtyley.github.io/bfg-repo-cleaner/
GNU General Public License v3.0
10.83k stars 535 forks source link

Push errors: deny updating a hidden ref #482

Closed robertpatrick closed 1 year ago

robertpatrick commented 1 year ago

I was able to use --delete-files to delete the large file in my project history. After running git reflog expire --expire=now --all and git gc --prune=now --aggressive, the server is rejecting the necessary updates as a result of my git push -f --mirror:

...
 ! [remote rejected]       refs/merge-requests/994/head -> refs/merge-requests/994/head (deny updating a hidden ref)
 ! [remote rejected]       refs/merge-requests/996/head -> refs/merge-requests/996/head (deny updating a hidden ref)
 ! [remote rejected]       refs/merge-requests/997/head -> refs/merge-requests/997/head (deny updating a hidden ref)
 ! [remote rejected]       refs/merge-requests/998/head -> refs/merge-requests/998/head (deny updating a hidden ref)
 ! [remote rejected]       refs/merge-requests/999/head -> refs/merge-requests/999/head (deny updating a hidden ref)
error: failed to push some refs to 'gitlab.<redacted>.git'

I am the Owner of the project in Gitlab and disabled branch protection to no avail. The deleted file still appear in the original commit where it was added.

robertpatrick commented 1 year ago

By the way, I also tried this with the original GitHub repo and got the same errors...

ChaseMillers commented 1 year ago

You ever find a solution?

robertpatrick commented 1 year ago

Moved to the git-filter-repo tool. Found large binary files BFG did not and didn’t have this issue.

ernstki commented 9 months ago

It's a GitLab thing, particular to the service, Gitaly, that does the Git stuff on the back end.

I was able to work around this by doing git clone --bare instead of git clone --mirror, and then force-pushing the active branches of my project back to the origin remote.

I also had to delete and reapply one tag, which was causing a whole arm of the old commit graph to be hanging around.

This is all a bit unwieldy, but my repo was small, with only a few dozen commits since its inception. Have a backup (fork) and think about it a bit before going down this route if you have a gargantuan repo with years worth of history and lots of tags. Or use a different tool, as suggested above.

References