Keep your Git repository clean
Back to home
On this page
When a Git repository contains a high number of references and files, the performance of Git can decrease. This is why most Git providers have repository size limits in place (for more information, see the GitHub, GitLab and Bitbucket documentation).
The Upsun API and Console are closely tied to Git. When the performance of Git decreases, Upsun API servers also become slower. As a user, you can then experience significant latencies. If your repository becomes too large, your Console may even become unresponsive, leaving you unable to access your project.
To avoid such issues, make sure you keep your Git repository clean by following the instructions on this page.
If you’re already facing performance issues and suspect they might be related to the size of your Git repository, see how you can troubleshoot a sizeable Git repository.
Enable the automated pruning of old branches in your project
To keep your repository size to a minimum, make sure that branches that don’t exist anymore in your repository have also been deleted from Upsun.
To automate this process, when setting up a source integration,
enable the prune-branches
option.
If you already have a source integration set up and want to enable the prune-branches
option,
follow these steps:
-
To enable the
prune-branches
option, you must first enable thefetch-branches
option. To do so, run the following command:upsun integration:update --project PROJECT_ID SOURCE_INTEGRATION_ID --fetch-branches true
-
Then, to enable the
prune-branches
option, run the following command:upsun integration:update --project PROJECT_ID SOURCE_INTEGRATION_ID --prune-branches true
- Navigate to your project.
- Click Settings.
- Click Project Settings.
- Click Integrations and select your source integration.
- Click Edit.
- Enter your access token and click Continue.
- Select your repository and check the following boxes:
- Fetch branches from the remote repository to your project (
fetch-branches
option, mandatory to enableprune-branches
). - Remove branches from your project that have disappeared remotely (requires the fetch branches option to be enabled) (
prune-branches
option).
- Fetch branches from the remote repository to your project (
- Click Save.
Upload your files through mounts
Keeping too many files, especially large binary files, in your Git repository can cause performance and stability issues. Therefore, Upsun recommends that you only commit your source code in Git.
To upload any other files to your app, create mounts and transfer your files directly to them.
Note
Upsun does not currently support Git Large File Storage.
Troubleshoot a sizeable Git repository
If you’re experiencing latencies or can’t access your Console anymore, your Git repository may have become too large and may need to be cleaned up. To do so, follow these instructions:
- Remove old, unwanted files from your repository (especially large files). You can do it manually, or use a tool such as BFG Repo-Cleaner.
- Remove stale branches from your repository and Upsun project.
- Rebase and/or squash commits to clean up your history.
- Make sure you enable the automated pruning of old branches in your project and upload your files through mounts to avoid facing the same situation in the future.