Interacting with large Git repositories
Overleaf users sometimes run into trouble synchronizing their large Git repositories with an Overleaf project. This page provides some guidance on how to manage this situation.
Research projects often involve broad software repositories containing raw data, processing scripts (e.g., Python or R), literature PDFs, and experimental outputs alongside LaTeX source files. Git repositories that are used in research or teaching workflows often contain many different types of resources.
An Overleaf project, on the other hand, is designed specifically to compile a single LaTeX document. A project should not be used as a general storage space for research artifacts (PDFs, data sets, etc.).
While there are cases where a project can contain independently compilable LaTeX source files, in most cases each Overleaf project should be used to compile a single document, and each of your LaTeX documents should be in a distinct project. Conceptually related projects can be organized using tags, and common files that are required by multiple projects can be shared between projects.
Separating your LaTeX compilation files from your broader research workspace provides a modular structure for sharing, backing up, and managing both your research assets and your final manuscript.
Problems with large repositories
You may need to restructure your repository if you encounter any of the following issues when attempting to import a project or synchronize with GitHub, or when you push or pull using the Git integration.
GitHub Sync errors: This error may be reported as "We couldn’t reach GitHub. Please try again in a few moments." This error can be caused by API Timeout Errors, triggered by the inclusion of large files or large multi-file commits.
Git Integration timeouts, or failures to push: Timeouts can be experienced when pushing large artifacts or large commits via the Git Integration.
File limitations on the Overleaf side: Limitations on the total number of files or on the amount of editable text can be shown on the Overleaf side when the project is linked to a large repository. Please see Plan limits.
Recommended workflow strategies
Depending on whether you prefer local command-line tools or cloud-based automation, several flexible workflows can keep a main workspace up-to-date with an Overleaf project.
In these workflows, we assume that you have a general research or teaching repository that we will refer to as your workspace repository. This workplace repository may contain data, scripts, PDFs of related papers, and other artifacts in addition to the LaTeX source files. In contrast, we will refer to the repository that solely contains the LaTeX source files that are to be kept in sync with an Overleaf project as your paper repository.
There are several strategies for setting up a relationship between the workspace repository and the paper repository to keep them up-to-date with each other. These can be automated or can be implemented as manual processes.
Strategy 1: Dedicated sub-repository (submodules or subtrees)
You can isolate your document files into a dedicated paper repository, then embed that repository inside your main research repository as a Git submodule or subtree.
Structure: The dedicated paper repository contains only the files needed for LaTeX compilation.
On Overleaf: Connect your Overleaf project directly to the dedicated paper repository using GitHub Synchronization or the Git Integration.
Within Git or GitHub: Embed the paper repository inside your main workspace repository as a submodule or folder subtree.
Workflow: Local edits inside the submodule directory can be pushed directly to update Overleaf, while your main repository tracks overall project history.
Strategy 2: Automated folder synchronization (GitHub Actions)
If you prefer to maintain separate, standalone repositories without using submodules, you can automate file transfers between them.
Structure: Maintain a primary workspace repository for research data and a secondary paper repository for the Overleaf project.
Git or GitHub automation: Set up a GitHub Actions or CI/CD workflows in your workspace and/or repository. The workflows can be automatically triggered or explicit invocation. These may copy LaTeX assets from the paper repository back to the workspace repository, or may copy other assets (generated figures, tables) from the workspace repository to the paper repository.
Workflow: Whenever you update figures or tables in the workspace repo, the action copies those specific assets to the paper repository, which is synchronized with your Overleaf project.
Strategy 3: Local copying
For workflows managed entirely on a local machine, you can use the Overleaf Git Integration to bridge your directories without cloud automation.
Structure: Clone both your main workflow repository locally and your Overleaf project locally (using the Overleaf Git URL). These are independent folders on your local machine.
Workflow: Use local build scripts or standard copy commands to transfer generated figures or updated tables from your local workspace folder into your local Overleaf clone. Commit and push from the local Overleaf clone directly to the Overleaf remote.
Course and teaching repositories
While this guide focuses on a single paper within a research workspace, these architectural patterns also apply to other multi-artifact environments. For instance, instructors managing a course repository (containing lecture slides, assignment sheets, solution keys, and syllabi) face similar scope challenges.
When specific LaTeX assets from a master course folder need to be edited in Overleaf, those specific subfolders can be extracted into dedicated paper repositories using the same submodule, subtree, or automated mirroring methods as described above.
Limitations
While separating LaTeX assets into dedicated repositories resolves project size and timeout issues, you should evaluate the following trade-offs:
1:1 mapping requirement: Overleaf integrations require a direct link between a single Overleaf project and a single Git repository. Overleaf cannot link directly to a sub-folder within a repository.
Multiple repositories: Extracting many distinct LaTeX documents from a single mono-repo may be challenging. If your team or personal workflow requires many distinct documents to reside in the same repository, creating and multiple sub repos or sub trees may be difficult.
Shared dependencies: If multiple documents share a single common resource, that dependency must be manually duplicated or synced across every secondary repository.
Last updated
Was this helpful?