Create
cancel
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
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 29, 2022

Hello,

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://example.com/some-big-repo.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
[core]
repositoryformatversion = 0
filemode = false
bare = true
symlinks = false
ignorecase = true
[remote "origin"]
url = ssh://git@bitbucket.XXX.XXXX.ch:1111/XXX/XXXX-XXXX.git
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
remote:
To ssh://bitbucket.XXX.XXX.ch:XXXX/XXXX/XXXX-XXXX.git
! [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://bitbucket.XXX.XXXX.ch:1111/XXXX/XXXX-XXXX.git'

I have take a look at https://community.atlassian.com/t5/Bitbucket-questions/Bitbucket-reserved-refs-when-cleaning-up-with-BFG-tool/qaq-p/702969 but could not make it work. 

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

Thank you in advance,

Enrique

 

1 comment

Daniel Holmes August 6, 2024

I'm even seeing this problem pushing to a new repo

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events