Help

How do I connect an Overleaf project with a repo on GitHub, GitLab or BitBucket?

There are two main ways to use Overleaf with a project on GitHub, GitLab or BitBucket: add your Overleaf project as a remote, or add it as a submodule. The instructions below reference GitHub, but the process is the same GitLab, BitBucket or other hosted git providers.

Add an Overleaf Project as a Git Remote

If you have an repo on GitHub that you would like to create as a project on Overleaf, you can push it to Overleaf as a new project via git.

If you have a project on Overleaf that you want to push to GitHub, you can git clone the project from Overleaf and then follow GitHub's instructions to push the repo to GitHub.

Add an Overleaf Project as a Git Submodule

Each project on Overleaf gets its own git repo, but if you want to organise several papers into one git repo on GitHub, you can add each paper as a git submodule in the usual way.

Important Privacy Considerations

If you have a git repo with both an Overleaf project and a GitHub repo as remotes, the default message for a merge commit will contain the secret link for your Overleaf project. If you are using a public repo on GitHub, please be aware that this will publish the secret link to your project in your commit history on GitHub.

If you would like to keep the secret link secret, you can either make the Overleaf project a Protected Project (available on our Pro plan), so users will require an explicit invite to the project, or use a private repo on GitHub (or BitBucket, etc.).

The same applies to git submodules, because submodule references are stored in plaintext in the including repo. If you make this repo public, you also make the submodule references public.