Overleaf offers Git-Bridge and GitHub Synchronization features that allow you to link your Overleaf projects with local Git repositories or synchronize them with Git repositories hosted on GitHub. The Git-Bridge and GitHub Synchronization features are premium Overleaf features, available with an Overleaf subscription.
Overleaf Git-Bridge and GitHub Synchronization features allow you to work on your LaTeX source offline, help you to share with collaborators outside of Overleaf, and allow you to integrate Overleaf into more complex workflows.
The Git-Bridge feature allows you to clone your Overleaf project to a local repository, treating your Overleaf project as a remote repository that changes can be pushed to and pulled from.
When you git clone, or perform a git pull from or git push to Overleaf, you will be asked to sign in using your Overleaf user name (your primary email address) and password. Please note that if you signed up using another provider, such as Google or institutional SSO you will need to set an Overleaf password first. You can do this via your Account Settings.
To avoid having to enter your credentials every time, you can configure your git client to remember them, either permanently or for a limited time. There are several options depending on your platform. Please note that SSH key access is not supported on Overleaf.
From the Overleaf Project menu within your project, you can select Git from the Synchronization options. This will bring up a dialog showing the git clone command to use when creating your local repository.
Alternately, you can find the Git url from the project url (the url in the browser address bar when you are in a project). If your Overleaf project url looks like:
Then the Git url to use to clone the project will be
And the command used to clone the project into a local Git repository will be:
git clone https://git.overleaf.com/1234567
Your Overleaf project will act as a remote repository for your local repository. You can make local changes, commit, and push them to your Overleaf project, and pull updates from Overleaf to your local repository.
If you have an existing repository, you can add an Overleaf project as a remote repository. There are a few commands below that you'll need to run to get things started.
$ cd my-paper $ git remote add overleaf https://git.overleaf.com/5b98bfbf54474d00010421b1
(Be sure to use your own link, not the example link.)
$ git checkout master $ git pull overleaf master --allow-unrelated-histories
$ git revert --mainline 1 HEAD
$ git push overleaf master
Please see this page for suggestions on troubleshooting common Git-bridge problems.
The GitHub Synchronization feature allows you to link your Overleaf projects directly to a GitHub repository that acts as a remote repository for your Overleaf project, and provides a way to push and pull changes between them. GitHub synchronization can only be used on Github.com and cannot be used to connect to other GitHub enterprise installations.
You can synchronize an Overleaf project with a GitHub repository by either creating a new Overleaf project from an existing GitHub repository or by creating a new GitHub repository from an existing Overleaf project. It is not possible to synchronize an existing Overleaf project with an existing Github repository.
In order to use the GitHub Synchronization feature, you must link your Overleaf account to your Github account. You can do this in your Overleaf Account Settings. Please note that the ability of Overleaf to connect to certain repositories or organizations associated with your account may depend on the permission settings that have been configured in GitHub.
From the New Project menu, you can select the GitHub option. This will present you with a list of repositories that are visible to Overleaf through your GitHub account, based on your GitHub permission settings.
Some things to note when creating a new Overleaf project from an existing GitHub repository.
From the Overleaf Project menu, you can select GitHub as one of the Synchronization options. This will provide you with a dialog where you can provide the name of a new GitHub repository to synchronize with your Overleaf project.
When you need to push changes to your GitHub repository from Overleaf or pull changes from GitHub into your project, click on the GitHub option in the Project menu.
Branches: The Overleaf Git system does not support branching.
Symlinks: The Overleaf Git system does not handle Symlinks well. A symlink can be pushed into an Overleaf project, but will be converted to a regular file, and will over-write the local symlink the next time the project is pulled.
File Permissions: The Overleaf Git system does not preserve execute permissions. To work around this, you can run
git config core.fileMode false in your local clone of the repository. Then you can reset the execute permissions on any affected files. This way they won't be modified again with subsequent Git operations.
Git LFS Overleaf projects do not support Git Large File Storage.
Git Submodules Overleaf projects can act as Git submodules within other repositories, but cannot contain other Git submodules. To reference files from other projects, it is suggested to use the add from another project feature.
Renaming Folders: If a user renames a folder, and pushes the change to Overleaf, the project will retain an empty folder with the old name, in addition to the new folder. (For example, renaming images/ to img/ will leave two folders in the project: img/ containing the image files, and images/, which will be empty.This can cause problems when a user renames a folder, and creates a new file with the same name as the old folder, in one commit. The Overleaf Git system will reject this commits. In this case we recommend splitting the commit up into two parts, and deleting remaining folder.
Changing GitHub repositories: Once a connection is made with a GitHub repository, a project cannot be directly linked with a different GitHub repository.