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
11.15k stars 551 forks source link

git push issue using a gerrit repository #141

Open ss8913 opened 8 years ago

ss8913 commented 8 years ago

So, first off, I've made a sandbox repo and intentionally recreated my large-file problem in it; I want to remove the large (2.0gb) file from the git repo. The wrench in the works is that the backend is actually gerrit, which might be causing problems here... using the centos 7 java-1.7.0-openjdk java... so what I did:

git clone --mirror ssh://servername/sandbox java -jar ~/bfg.jar --strip-blobs-bigger-than 10M sandbox.git cd sandbox.git git reflog expire --expire=now --all && git gc --prune=now --aggressive

everything's fine up to this point. all looks exactly like what I expected and wanted. Then i do 'git push' and I get:

Counting objects: 36, done.
Compressing objects: 100% (16/16), done.
Writing objects: 100% (26/26), 2.89 KiB | 0 bytes/s, done.
Total 26 (delta 10), reused 22 (delta 7)
remote: Resolving deltas: 100% (10/10)
remote: Processing changes: refs: 26, done
To ssh://gerrit.syseng/sandbox
! [remote rejected] master -> master (non-fast forward)
! [remote rejected] test -> test (non-fast forward)
! [remote rejected] refs/meta/config -> refs/meta/config (non-fast forward)
! [remote rejected] refs/cache-automerge/5e/cc9d3dff9d66ce3a91511309378670c4cc3441 -> refs/cache-automerge/5e/cc9d3dff9d66ce3a91511309378670c4cc3441 (prohibited by Gerrit)
! [remote rejected] refs/cache-automerge/b6/37af3bb19dfb86b502249961c59327254c3c17 -> refs/cache-automerge/b6/37af3bb19dfb86b502249961c59327254c3c17 (prohibited by Gerrit)
! [remote rejected] refs/changes/13/313/1 -> refs/changes/13/313/1 (failed to lock)
! [remote rejected] refs/changes/14/314/1 -> refs/changes/14/314/1 (failed to lock)
! [remote rejected] refs/changes/15/315/1 -> refs/changes/15/315/1 (failed to lock)
! [remote rejected] refs/changes/16/316/1 -> refs/changes/16/316/1 (failed to lock)
! [remote rejected] refs/changes/17/317/1 -> refs/changes/17/317/1 (failed to lock)
! [remote rejected] refs/changes/18/318/1 -> refs/changes/18/318/1 (failed to lock)
! [remote rejected] refs/changes/25/825/1 -> refs/changes/25/825/1 (failed to lock)
! [remote rejected] refs/changes/27/427/1 -> refs/changes/27/427/1 (failed to lock)
! [remote rejected] refs/changes/28/428/1 -> refs/changes/28/428/1 (failed to lock)
! [remote rejected] refs/changes/29/429/1 -> refs/changes/29/429/1 (failed to lock)
! [remote rejected] refs/changes/30/430/1 -> refs/changes/30/430/1 (failed to lock)
! [remote rejected] refs/changes/39/1539/1 -> refs/changes/39/1539/1 (failed to lock)
! [remote rejected] refs/changes/39/1539/2 -> refs/changes/39/1539/2 (failed to lock)
! [remote rejected] refs/changes/44/344/1 -> refs/changes/44/344/1 (failed to lock)
! [remote rejected] refs/changes/45/345/1 -> refs/changes/45/345/1 (failed to lock)
! [remote rejected] refs/changes/46/346/1 -> refs/changes/46/346/1 (failed to lock)
! [remote rejected] refs/changes/47/347/1 -> refs/changes/47/347/1 (failed to lock)
! [remote rejected] refs/changes/48/348/1 -> refs/changes/48/348/1 (failed to lock)
! [remote rejected] refs/changes/49/349/1 -> refs/changes/49/349/1 (failed to lock)
! [remote rejected] refs/changes/50/350/1 -> refs/changes/50/350/1 (failed to lock)
! [remote rejected] refs/changes/51/351/1 -> refs/changes/51/351/1 (failed to lock)
! [remote rejected] refs/changes/54/354/1 -> refs/changes/54/354/1 (failed to lock)
! [remote rejected] refs/changes/92/392/1 -> refs/changes/92/392/1 (failed to lock)
! [remote rejected] refs/changes/96/396/1 -> refs/changes/96/396/1 (failed to lock)

I am operating as a user that has full admin privileges both for gerrit itself and this project. Every possible gerrit permission is turned on. adding --force to 'git push' does not alter the behavior.

Not sure what to do at this point; google has been no help; I may be the only person trying to do this with gerrit(?) but I'm hoping not. :)

javabrett commented 8 years ago

As always, if you are rewriting-history and pushing to remote repos, always ensure you have full backups, full mirror-clones etc., and have communicated with your team.

I see that you tried --force. You are rewriting history, and your remote may even reject this even with -f. Can you push any sort of trivial non-fast-forward ref to your remote, or is that blocked too? If it is, you will need to refer to your Git server doc on how to unprotect that branch.

Google something like: prohibited by Gerrit non fast forward . First hit I read suggested that Gerrit bans this and you need to bypass it and write direct to the repository.