Slow workflow loading and builds stuck in queue for large repositories

Last updated: July 10, 2026

If workflows take a long time to load or builds remain in the Queued or Initializing state for an extended period, this may be caused by a large Git repository that takes longer for Codemagic workers to fetch and process.

Why this happens

Before a build can start, Codemagic needs to fetch the repository and read the workflow configuration. For very large repositories, especially those with long Git histories, many objects, or unpacked objects, this step can take longer than expected and may require retries. As a result, the build may appear to stay in the queue or initialization phase for an unusually long time.

Solution

You can resolve this issue by cleaning up your repository using the following steps:

  1. For repositories hosted on platforms like GitHub, GitLab, Bitbucket:

    1. Clone your repository locally

    2. Run the following commands:

      • git gc - Cleanup unnecessary files and optimize the local repository (docs)

      • git repack -A - Pack unpacked objects (docs)

    3. Force push the changes back to your remote repository (if needed)

  2. For self-hosted Git repositories: Before modifying client-side configurations, perform maintenance on the server side:

    1. Log into your git server (e.g., ssh source.example.com)

    2. Navigate to your repository directory: cd /path/to/your/repo

    3. Run housekeeping commands:

      • git gc - Cleanup unnecessary files

      • git repack -A - Pack unpacked objects

Important note

Simply deleting branches is usually not enough to resolve this issue. Deleted branches do not necessarily remove the underlying Git history or stored objects. Repository cleanup is needed to address the Git object storage that can cause slow workflow loading or long initialization times.