Deploy failure: fail to prepare the repo (when repo is around 1G)


I have a netlify site [] that automatically deploys from a larger gitlab repo. There used to be no issue deploying. However, it kept failing to today, and the error message was “failed to prepare for repo”:

6:06:13 PM: Starting to prepare the repo for build
6:06:14 PM: No cached dependencies found. Cloning fresh repo
6:06:14 PM: git clone
6:11:41 PM: Error cloning repository:
6:11:41 PM: Creating deploy upload records
6:11:41 PM: Failing build: Failed to prepare repo
6:11:41 PM: Failed during stage ‘preparing repo’: exit status 255
6:11:41 PM: Finished processing build request in 5m28.44339749s

I’ve tried to clear cache and re-deploy, and I’ve also tried to clone the repo locally to my pc (though it took longer time, it was cloned without an error). Since these two tricks didn’t help me debug… I would love to know what else I can try? Thanks!

Hey there, @SzuHannah :wave:

Welcome to the Netlify Forums! Thanks for sharing this with us. It looks like this thread has been a bit quiet since you first wrote in-- sorry about that!

Is this issue still occurring for you? Are there any additional debugging steps you have taken since you reached out? Let me know, and I will bring that information to the appropriate folks :slight_smile:

Hi, @SzuHannah. The repo isn’t 1 GB, it is 10.9 GB. The issue here appears to be a timeout occurring when cloning this repo. The repo is public so I visited its GitLab page. You can see the size of the repo in the screenshot below:

The repository contains 1.9 billion files and is using 10.9 GB of storage.

We can troubleshoot how large of a repo you can clone at Netlify. However, this is likely to end in a feature request. We might find a resolution more quickly if the size of the repo itself was reduced.

To do this, we need to understand if the size is intentional or an accident. (For example, sometimes people commit node_modules to their repo.) Would you be willing to please answer some questions about this repo?

Why is this repo so large? I cannot find the location of the majority of these 1.9 billion files. Do you know where in the repo history and directory structure those files are found?

Hi @luke . Thanks for the reply! I currently cannot seem to find the location of these billions of files… Thanks for pointing out the repo size problem. We’ve decided to reduce the repo size, and currently, that solved the problem.

Hi, @SzuHannah. Thank you for taking the time to let us know how you resolved the issue.

This is very helpful for people searching these forums and the support team here at Netlify thanks you for sharing your solution. :+1: