Failed during stage 'preparing repo'

Trying to deploy to bitbucket gives me this result:

12:02:46 AM: build-image version: 4c0c1cadee6a31c9bb8d824514030009c4c05c6a (focal)
12:02:46 AM: build-image tag: v4.15.0
12:02:46 AM: buildbot version: cc0c986a947e274d444f48f63f797a5d01f2a89a
12:02:46 AM: Fetching cached dependencies
12:02:46 AM: Failed to fetch cache, continuing with build
12:02:46 AM: Starting to prepare the repo for build
12:02:47 AM: Creating deploy upload records
12:02:47 AM: Failing build: Failed to prepare repo
12:02:47 AM: Failed during stage 'preparing repo': For more information, visit https://docs.netlify.com/configure-builds/troubleshooting-tips/#build-fails-with-error-128: exit status 128
12:02:47 AM: Finished processing build request in 671.985754ms

As a note, I couldn’t connect to the repo using netlify’s ui and connected using cli. Maybe it’s somehow related.

Hi @adam.genshaft,

My first suggestion would be to unlink and relink your repo. I got that suggestion from this part of our documentation. Take a quick read of that doc for the details, do the deed and let us know how it goes!

Thanks for the answer, however I’ve posted it since I have tried all the recommended approaches but could not resolve it with any guidance from the docs.

Also note that I have admin permissions on that bitbucket account. I was even hoping to find a bitbucket plugin for netlify, but I’ve found none.

Here are the steps that I remember I took:

  1. I’ve revoked the netlify’s access to bitbucket and reconnected
  2. I’ve deleted the netlify account and created a new one
  3. I have connected using the cli and started implementing my own script to deploy which brought me to open another issue with netlify.

And frankly I’m surprised because as a solo developer working on small side project I use netlify all the time and it works great. But when using for a legitimate client that can put money on the table (if only it works), I have so many issues. Maybe you’re not as well integrated with bitbucket or have other internal reasons, it’s reasonable and I can understand all of that. I’d just expect you to state what your limitations are on your public docs instead of giving me a bookmark copy pasted answer.

The post seems to be missing some basic information like either:

  1. Site name
  2. OR site ID
  3. or deploy ID

I see our “copy-paste” answer has upset you, but you haven’t provided any useful information to better investigate either. Looking forward to get that info, so we can check.

The site ID is zm-front, thanks.

Hey @adam.genshaft,

We checked this, and it appears, we’re having some troubles cloning your repo:

Failed to check if ref refs/heads/master exists

In the past, for various customers, this has meant that, they had their repo configured in a way that Netlify could not access. It could be network firewalls, or some access controls setup, or even a pre-commit hook of some kind. Could you confirm if it’s nothing of that sort for you?

You are right, adding netlify’s ssh key to bitbucket resolved it.
Thanks!