Deploy fails with “failed during stage ‘preparing repo’: exit status 1”

I’m having trouble having Netlify building and deploying my site from GitHub. I’ve posted about this here before but the same issue is still happening and is unresolved.

When I originally set up my GitHub repo with Netlify, Netlify’s build and deploy worked just fine. However I had a pull request with a large number of images in it and it gave me the following error each time I pushed a commit to build:

8:09:32 PM: Build ready to start
8:09:34 PM: build-image version: 2dbd444fcdce00cf06325060a8238d5ae3e86774
8:09:34 PM: build-image tag: v3.3.7
8:09:34 PM: buildbot version: 134ec431c6a3ff76e87cc4dc34007fe13842272f
8:09:34 PM: Fetching cached dependencies
8:09:35 PM: Starting to download cache of 319.3MB
8:09:47 PM: Finished downloading cache in 12.548108165s
8:09:47 PM: Starting to extract cache
8:09:59 PM: Finished extracting cache in 11.857813179s
8:09:59 PM: Finished fetching cache in 24.558800316s
8:09:59 PM: Starting to prepare the repo for build
8:09:59 PM: Preparing Git Reference pull/107/head
8:10:01 PM: Failing build: Failed to prepare repo
8:10:01 PM: failed during stage 'preparing repo': exit status 1
8:10:01 PM: Finished processing build request in 27.067839529s

I ended up deleting the entire site in Netlify and recreating it, which fixed the issue but I would love to avoid such extreme measures in the future. After this fix, I was able Netlify worked just fine with code-only commits (no images).

This week I created a pull request with a single image and Netlify started returning the same error:

8:10:42 PM: Build ready to start
8:10:44 PM: build-image version: 2dbd444fcdce00cf06325060a8238d5ae3e86774
8:10:44 PM: build-image tag: v3.3.7
8:10:44 PM: buildbot version: d305548225ac57bb00eb5a596b0b8674e76a4681
8:10:44 PM: Fetching cached dependencies
8:10:44 PM: Starting to download cache of 336.9MB
8:10:48 PM: Finished downloading cache in 3.510507091s
8:10:48 PM: Starting to extract cache
8:10:59 PM: Finished extracting cache in 10.961078922s
8:10:59 PM: Finished fetching cache in 14.557809822s
8:10:59 PM: Starting to prepare the repo for build
8:10:59 PM: Preparing Git Reference refs/heads/master
8:11:01 PM: Failing build: Failed to prepare repo
8:11:01 PM: failed during stage 'preparing repo': exit status 1
8:11:01 PM: Finished processing build request in 16.824491485s

This time I followed Perry’s advice: I completely removed the Netlify app from GitHub and revoked its access, waited a few minutes, and reinstalled it.

This didn’t work.

Now it seems Netlify isn’t even installed. Github isn’t showing the Netlify checks in PRs anymore, and Netlify isn’t building recent commits or deploying what’s in GH master.

What can I do to reconnect my GitHub account with Netlify and keep things from breaking when I upload an image to my site?


Another odd thing I notice is that Netlify is prompting me to install the Github app after I supposedly installed it. Why would this happen?

hey ted, its me again! I know we already tried to resolve this, and what we tried didn’t work. I am going to wait for another Support Engineer who knows more about Git to chime in, but he’s out this week.

It may take us a few days, but we won’t forget - we’ll get this working somehow. Are you able to deploy using the CLI? :thinking:

Hi Perry, appreciate the reply. I think part (or most) of the problem is that after I uninstalled the Netlify app on GitHub, it didn’t reinstall properly.

Here’s a recording of what happens when I reinstall the GitHub app from Netlify.

Before I uninstalled it, Netlify appeared on the tabs for Installed GitHub Apps, Authorized GitHub Apps, and Authorized OAuth Apps.

After I reinstall it, it only appears on Installed GitHub Apps. Does this mean it’s installed but doesn’t have the proper permissions to run?

Hey Ted and thanks for your patience while I dug into our internal logs. The unfortunate reality is that you’re hitting a rare bug where we can’t handle your repo from cache. Nothing to do with GitHub app - that is configured correctly and working - otherwise we wouldn’t be able to report deploy status to github the way we do in your checks.

The only fix I’m aware of is to trigger a rebuild without cache which I think you’ve probably already tried:

This should fix your next build and MAYBE future builds, but at a guess, it will only work for a single build for you since the impact of the bug I can see from our internal logs is pretty big for your site (sometimes it impacts a single file; in your case it is over a hundred). It is anyway worth trying as it could end up being a longer term fix. But, do note you may have to do it for EVERY active PR and branch since they each have their own cache…

I’ll be able to follow up in this thread when we get the bug fixed, but that doesn’t help you much today. Wish I had better news for you, but I am hoping to get some eyes on that bug since it is popping up more frequently these days so there is hope :slight_smile:

1 Like

Thanks a ton for the help, really appreciate it :heart:

I deployed manually while clearing the cache and the actual deploy seemed to work.

8:21:18 PM: Build ready to start
8:21:19 PM: build-image version: 6dfe19d15f524c85d6f9bf7df9fb30b0a9f0a61a
8:21:19 PM: build-image tag: v3.3.10
8:21:19 PM: buildbot version: 6bb3f784302b4ad90de13035b247a363a8bee34a
8:21:19 PM: Fetching cached dependencies
8:21:19 PM: Starting to download cache of 254.9KB
8:21:19 PM: Finished downloading cache in 62.552541ms
8:21:19 PM: Starting to extract cache
8:21:19 PM: Failed to fetch cache, continuing with build
8:21:19 PM: Starting to prepare the repo for build
8:21:20 PM: No cached dependencies found. Cloning fresh repo
...
...
8:22:47 PM: Post processing done
8:22:47 PM: Site is live
8:23:24 PM: Finished processing build request in 2m4.770959908s

Cool… progress!

However what was built didn’t seem to make it to my production site (if you scroll to the page bottom, there should be an extra section titled Following up some more.

I wonder if the deploys are working fine, but my Netlify app on GitHub doesn’t have the adequate permissions.

Does this look right? I’m no longer seeing Netify’s checks in my pull requests. When I reinstall the Netlify app on Github, the screens says it will redirect to GitHub where I’ll finish the installation, but it never does.



No Netlify checks :confused:

Hey @tedgoas, we’re still looking into your repo situation, but I did want to share how to get “what was built” (https://5eb9ebfdd6602d2ba9c97c33--tedgoas.netlify.app/) to your production site. You can go to the deploy page here:
https://app.netlify.com/sites/tedgoas/deploys/5eb9ebfdd6602d2ba9c97c33

And click “Publish deploy”

More to come soon re: your repo…

1 Like

Thanks so much, that worked and unblocked me for the moment!

1 Like