The contents applies to Overleaf V1 only. For information about working with git on Overleaf V2, see this page .
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.
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.
Each project on Overleaf gets its own git repo, but if you want to organise several such projects into one git repo on GitHub, you can add the repo for each project as a git submodule in the usual way. You can then push and pull each submodule repository to/from Overleaf individually and still have them collected together as submodules in the project on GitHub.
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.