Git can not find remote ref of Bitbucket Server pull request

We have faced an issue with Bitbucket Server pull requests on our pipeline.

  • Bitbucket Server v7.4.0
  • Drone v1.9.0.

However push actions are fine.

We have started to facing this issue after the repository got renamed.

For example I have tried to restart a previous PR (without this issue) when the repo had its original name yet, but then I got the same issue described here.

We have tried to re-sync the repos (close / re-open the PR) again but It doesn’t help so much.

couldn’t find remote ref refs/pull-requests/28/from

this error would indicate that when git tries to clone the pull request, the Bitbucket server is responding that the pull request reference does not exist. If Bitbucket server is returning an error when git is trying to clone a reference, you may need to check your Bitbucket server logs or contact Atlassian support for more details.

Strange we don’t see related issues on logs but after restart the build and close/re-open few times the same PR, It works.
Curious, because the PR ref url now redirects to corresponding PR ref but it was not found in the past.

Just to remark that this thread is already reported to Atlassian community.

Here is also more related threads

I’ll reiterate here that Bitbucket Server’s pull request refs are not API , and have never been considered API, so the way they work is dangerous to rely on

Their response is rather unfortunate. They effectively blame their customers for using a feature they claim was undocumented, despite the fact that it has been formally documented as the recommended approach for cloning a pull request at

Update: I just commented on the issue.

It looks like there is a workaround. We would need to make an API call to generate the diff which in turn would ensure the pull-request references are created.


1 Like

Shame Atlassian’s answer even with a previous user’s comment on top since April.
Looks like they are not willing to tackle on this issue.

Our team has realized about the problem just after an major upgrade (v6 to v7) and just this week due failed PRs on Drone pipelines.

Could be this workaround a TODO for Drone team?

Yes, we will unfortunately have to develop a workaround in Drone. We could otherwise be waiting for years for Atlassian support to resolve this matter …

Awesome! I hope is not a burden for Drone team. If you help with testing this we are able do it.

And yeah… our team unfortunately does not trust on Atlassian in this regard.

@joseluisq also looks like there may be a plugin available at that solves this issue. Have you tried this as a workaround?

Hey @bradrydzewski thanks for the hint!
We have tested the Java plug-in internally and works as intended. I have also reproduced the same behavior explained above, but without issues this time.
Drone is now able to get those PR references back again.
It was a matter of just upload the .jar file only.

Finally our latest testing output of Drone on same project but using the Eager PR Plugin.

Awesome! However, as a workaround is more than fine for but I don’t know if also Drone can consider to include this workaround as well. Because a PR event on Drone pipelines is a common feature that I think should work out of the box.

Yes, we still plan on implementing the fix / workaround and have an issue in our tracker [1] that can be subscribed to. The java plugin should be used as a temporary fix for now.


1 Like