Git push failure

I am trying to cleanup huge git repo history using BFG cleaner tool.

For same i first create a mirror of git repo to be cleaned.

git clone --mirror git://example.com/some-big-repo.git

I run few commands to do the clean and later when I am finished I try to push my changes.

git push

This fails with below stack trace

Counting objects: 217307, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (80946/80946), done.
Writing objects: 100% (214361/214361), 666.42 MiB | 1.15 MiB/s, done.
Total 214361 (delta 118358), reused 209184 (delta 114750)
remote: You are attempting to update refs that are reserved for Stash's pull request
remote: functionality. Stash manages these refs automatically, and they may not be
remote: updated by users.
remote: 
remote: Rejected refs:
remote:     refs/pull-requests/190/from
remote:     refs/pull-requests/247/from
remote:     refs/pull-requests/247/merge
To ssh://git@example.com/some-big-repo.git
 ! [remote rejected] CLI-PS-Command-Shows-Tag-And-Branch -> CLI-PS-Command-Shows-Tag-And-Branch (pre-receive hook declined)
 ! [remote rejected] IBIS-17123 -> IBIS-17123 (pre-receive hook declined)
 ! [remote rejected] IBIS-17763 -> IBIS-17763 (pre-receive hook declined)
 ! [remote rejected] IBIS-18435_Branch_7_1 -> IBIS-18435_Branch_7_1 (pre-receive hook declined)
 ! [remote rejected] IBIS-20151_Rename_non_existing_Object_ia_CLI -> IBIS-20151_Rename_non_existing_Object_ia_CLI (pre-receive hook declined)
 ! [remote rejected] IBIS-20261_variables_of_queued_processes_71 -> IBIS-20261_variables_of_queued_processes_71 (pre-receive hook declined)
 ! [remote rejected] IBIS-20589 -> IBIS-20589 (pre-receive hook declined)
 ! [remote rejected] IBIS-20590 -> IBIS-20590 (pre-receive hook declined)
 ! [remote rejected] IBIS-20650_head -> IBIS-20650_head (pre-receive hook declined)
...

error: failed to push some refs to 'ssh://git@example.com/some-big-repo.git'

To fix above issue i tried to increase the stash hook buffer capacity as I thought that might be the failure reason.

Go to stash-config.properties
hook.callback.buffer.capacity=15728640

But i still continue to get the push error.

Please advise.

2 answers

The reason I was facing above issue is as I mirror clone the repository which also clones the pull requests.

remote: Rejected refs:
remote:     refs/pull-requests/190/from
remote:     refs/pull-requests/247/from
remote:     refs/pull-requests/247/merge

I had to get rid of the pull request(by either getting them merged or declined) and then do the mirror clone again Everything worked fine this time.

 

You have to deal with (decline or merge) the open pull requests in your repository.

I have faced with same problem (given in detailed below) during mirroring a git repository on Bitbucket server to an another server.

 

$ git push -f NEW-REMOTE --mirror
Counting objects: 31760, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (6841/6841), done.
Writing objects: 100% (31760/31760), 3.37 MiB | 0 bytes/s, done.
Total 31760 (delta 12540), reused 31760 (delta 12540)
remote: You are attempting to update refs that are reserved for Stash's pull request
remote: functionality. Stash manages these refs automatically, and they may not be
remote: updated by users.
remote:
remote: Rejected refs:
remote: refs/pull-requests/2/from

 

Actually the error message is not clear or informative or directive very much but it shows that something related to refs is wrong or missing in your source repository. In my problem, there was open pull requests in the source repository which I was mirroring to another server. I declined the pull requests (you might merge it regarding the pull request details) and then mirroring operation is accomplished without any error.

In order to see whether there is an open pull requests in your source repository, you can look at this link below:

https://git-repository-url/pull-requests?state=OPEN

 

 

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

216 views 3 7
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you