Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Pull request references don't allow me to push after use BFG tool

Enrique Casale Linde July 29, 2022


I'm trying to clean a Big file from the a bit bucket repository (> 2 GB) but the references for pull request don't let me. I make sure there were no PR in the repository.

This are the steps I follow

Step 1

Clone the repository using the --mirror tag to ensure all referenes are copied and what I will have in my local repository is a exact copy of the online repo.

git clone --mirror git://

Step 2

Clean all commit, branches and tags from references to files bigger than 2 GB

java -jar bfg.jar --strip-blobs-bigger-than 2048M OUR_REPOSITORY.git

Step 3

Delete all the unwanted data

git reflog expire --expire=now --all && git gc --prune=now --aggressive

Step 4

Update the changes to the online repository

git config -e
# Change configuration to ignore PR refs
repositoryformatversion = 0
filemode = false
bare = true
symlinks = false
ignorecase = true
[remote "origin"]
url = ssh://
fetch = +refs/heads/*:refs/heads/*
fetch = +refs/tags/*:refs/tags/*
mirror = true

git remote update

git push --force


After the step 4 I received this message

C:\Users\XXXX\Desktop\git\XXXX-XXXX.git>git push --force
Enter passphrase for key 'C:\Users\XXX/.ssh/id_rsa':
Enumerating objects: 4503, done.
Counting objects: 100% (727/727), done.
Delta compression using up to 12 threads
Compressing objects: 100% (57/57), done.
Writing objects: 100% (4503/4503), 1.33 MiB | 6.93 MiB/s, done.
Total 4503 (delta 725), reused 670 (delta 670), pack-reused 3776
remote: Resolving deltas: 100% (2608/2608), completed with 32 local objects.
remote: Checking connectivity: 41075, done.
remote: You are attempting to update refs that are reserved for Bitbucket's pull request functionality. Bitbucket manages these refs automatically, and they may not be updated by users.
remote: Rejected refs:
remote: refs/pull-requests/2683/from
remote: refs/pull-requests/2689/from
remote: refs/pull-requests/2694/from
To ssh://
! [remote rejected] refs/pull-requests/2683/from -> refs/pull-requests/2683/from (pre-receive hook declined)
! [remote rejected] refs/pull-requests/2689/from -> refs/pull-requests/2689/from (pre-receive hook declined)
! [remote rejected] refs/pull-requests/2694/from -> refs/pull-requests/2694/from (pre-receive hook declined)
error: failed to push some refs to 'ssh://'

I have take a look at but could not make it work. 

I'm not sure what else I can do besides create a new repository. 

Thank you in advance,





Log in or Sign up to comment
AUG Leaders

Atlassian Community Events