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.95k stars 540 forks source link

remote: GitLab: You are not allowed to force push code to a protected branch on this project, Remote Rejected pre-receive hook declined #340

Open KamalRajput opened 4 years ago

KamalRajput commented 4 years ago

Push failed after cleaning the repo. Followed the same steps as mentioned on the page.

  1. git clone --mirror ssh://git@git.trading.com:2222/repo.git
  2. cd repo.git
  3. java -jar ../bfg.jar --strip-blobs-bigger-than 29M --protect-blobs-from 0.0.1,0.0.2,1.1.5,2.5.0,2.6.2,2.9.0,2.9.1,2.9.2,3.0.0,3.0.1,3.0.2,3.1.0,3.1.1,3.1.2,3.2.0,3.2.1,3.2.2,3.3.0-DEVELOP,3.3.1-DEVELOP,3.3.2-DEVELOP,3.4.0-DEVELOP,3.4.1-DEVELOP,3.4.2-DEVELOP,3.5.0-DEVELOP,3.5.1-DEVELOP,ARC_341_branchTest,master
  4. git reflog expire --expire=now --all
  5. git gc --prune=now --aggressive
  6. git push image

Please help , how to fix this issue. I have checked the permission on the project. On branch master merge is allowed for maintainer. And i am a maintainer of the project which means i can push to the repo.

Regards, Kamal Rajput

gamerlv commented 4 years ago

One or more of your branches/tags are marked as protected: https://docs.gitlab.com/ee/user/project/protected_branches.html To rewrite history on a branch it must not be listed as protected.

KamalRajput commented 4 years ago

After removing all the branches from protected , i was able to push the code on gitlab. But the problem is that it has added extra objects on my repo and the size has increased from 6.5gb to 6.8gb.

But the wierd fact is that when i tried to clone the project on my local,size of repo is 800mb. I saw this problem has been faced by many of us but no actual solution has been provided to solve it.

Can anyone please help here. Is it a bug on GITLAB or something from bfg side.

javabrett commented 4 years ago

There's a number of similar issues discussed here. Often pull/merge requests holding on to old histories have to be deleted. I fresh project for the cleaned repo might even be required.

lrkwz commented 4 years ago

One or more of your branches/tags are marked as protected: https://docs.gitlab.com/ee/user/project/protected_branches.html To rewrite history on a branch it must not be listed as protected.

it should be specified in the doc's isn't it?

javabrett commented 4 years ago

it should be specified in the doc's isn't it? Maybe. You could propose a PR. But this kind of thing is Git-hosting-provider specific.