This document outlines the capacity limits for Git repositories, strategies for Git repository cleanup, and instructions for handling large binary files using Git Large File Storage (LFS).
Capacity limits
Git repository size: Each Git repository is limited to 20 GiB. The number of Git repositories is unlimited.
Git LFS:
Individual Git repository: No capacity limit.
Organization-wide: Limited to 20 TB.
Pay-as-you-go billing: Unlimited LFS for both individual Git repositories and organization-wide. For more information, see Codeup Git LFS feature introduction and Pay-as-you-go billing.
Git repository cleanup recommendations
To ensure optimal performance and prevent resource abuse, keep the data size of each Git repository under 5 GiB. Use Git LFS for storing large binary files.
When to clean up
Proactive cleanup: Regularly clean up your Git repository, even if it's below the limit.
90% capacity warning: You will receive a notification when your Git repository reaches 90% of its storage limit upon pushing code.
Capacity limit reached: You will be blocked from writing to the Git repository and limited to Garbage Collection (GC) cleanup.
Cleanup strategies
File cleanup:
Delete unnecessary files and folders.
Migrate binary files to Git LFS (strongly recommended). This significantly improves push and pull speeds.
GC:
GC compresses Git repository objects to reduce disk usage and improve performance.
How to perform GC:
Go to Settings > Basic Settings.
Click Clear.

Git LFS cleanup:
Deleting files from Git history does not automatically delete the corresponding LFS objects.
How to perform LFS cleanup:
Go to Settings > Large File Storage in your Git repository.
Select the files to delete.
Click delete.

Identify unused LFS objects.
The following command lists the LFS objects currently tracked by your repository. Use this output to identify and delete unused objects in the UI.
git lfs ls-files
Clean up large files in Git history
Submitting large binary files to a Git repository can lead to capacity issues and block new commits. The following steps guide you through migrating committed large files to Git LFS and removing them from the Git history.
This process rewrites Git history. It's crucial to have a backup of the remote Git repository.
Create a backup.
Clone the remote Git repository to a local machine and create a backup copy.
git clone <remote_repository_url>Install git-filter-repo.
This is the recommended tool for rewriting Git history.
pip3 install git-filter-repoClone a bare repository.
git clone --mirror --bare <remote_repository_url>Clean up large files.
Git-filter-repo offers 3 methods for cleaning up large files:
Cleanup by file size
Clean up files larger than 100M:
git filter-repo --strip-blobs-bigger-than 100M //Supports units: K, M, GCleanup by file path
Use the combination of --path and --invert-paths parameters to clean up files. For example, to delete the path/of/large/file.lib file and the bin/ directory from the repository's commit history, execute the following command:
git filter-repo --path path/of/large/file.lib --path /bin/ --invert-pathsThis command delete all directories and files specified by --path.
Cleanup by file blob ID
Write the blob ID of the large file into a file. For example, write the following large file blob IDs into a text file (for example, ids.txt).
xxxxxxxxxxxxxxxxxxxxxxxxxxx606ad018f872a xxxxxxxxxxxxxxxxxxxxxxxxxxx4c4a24868ede2Then execute the following command, which will delete the files whose blob ID is in the specified file (here, it is the ids.txt).
git filter-repo --strip-blobs-with-ids ids.txtOverwrite the remote Git repository:
a. Disable mirroring.
git config remote.origin.mirror falseb. Force push the rewritten history.
git push -u origin refs/heads/*:refs/heads/* -f git push -u origin refs/tags/*:refs/tags/* -fVerify overwrite.
Check on Codeup that the large files have been removed from the commit history of each branch.
Immediate Git repository cleanup
The Git repository size on Codeup might not reflect the changes immediately.
To force immediate cleanup:
Go to the Git repository's Settings.
Click Immediate Cleanup.
Select Immediate Delete.
This will remove the large files completely from the remote Git repository.
More methods for cleaning up large files
When committing code through the Agit-Flow push review mode, the original commit may also carry large files. On how to clean up these files, see How to clean up large file space introduced by Agit centralized review?