Sync a LaTeX project with GitHub

In web mode a project can be tied to a GitHub repository. One click commits your changes and brings in the changes made on GitHub. This guide goes through connecting, publishing, syncing and conflicts.

What the sync does

A sync compares three states: your files in the browser, the files on GitHub and the state of the last sync. Files you changed are committed to the branch, files changed on GitHub are written into your project, and a file changed on both sides becomes a conflict that you decide.

The editor needs no Git on your computer. It talks to the GitHub API from the browser and never force-pushes: if the branch moved while a sync was running, it stops and asks you to sync again.

The GitHub panel of a linked project: repository mara-lind/thesis, branch main, status "Everything in sync", a field for the commit message and the button "Sync now".
The panel of a linked project.

Connect your GitHub account

  1. Open a project in web mode and click the GitHub button in the top bar.

    The top bar of the editor with the GitHub button outlined, to the right of the Compile button.
  2. Click “Sign in with GitHub” and allow the access on the GitHub page that opens. If you prefer a token, click “Use a personal access token instead”, paste the token and click “Connect”.

    The panel "Connect with GitHub" with the button "Sign in with GitHub" and below it the field for a personal access token.
  3. The panel now shows “Connected as” with your GitHub name. The connection holds for every web project in this browser.

Publish a project as a new repository

  1. In the GitHub panel, click “Create new repository”.

  2. Check the repository name; the editor suggests the project name. “Private repository” is ticked, so only you see the repository until you change that on GitHub.

    The GitHub panel with the form for a new repository: name "Quick-Demo", the ticked box "Private repository" and the button "Create & publish".
  3. Click “Create & publish”. The editor creates the repository, commits all project files and links the project to it.

  1. In the GitHub panel, click “Link existing repository”.

  2. Type part of the name into the search field and click the repository. Then choose the branch.

    The list of repositories in the GitHub panel with "mara-lind/thesis" selected, the branch "main" below and the button "Link & sync".
  3. Click “Link & sync”. The first sync brings both sides together: files that exist on one side only are copied to the other, and files that differ show up as conflicts.

Sync your changes

  1. Open the GitHub panel. The status line says what is waiting: local changes, changes on GitHub, or “Everything in sync”.

  2. Write a commit message if you want one. Without it the commit gets a message with the date and time.

  3. Click “Sync now”. A notification says how many files were pushed and pulled.

Resolve conflicts

A conflict is a file that changed in the editor and on GitHub since the last sync. The sync lists these files and asks you. A file in that list is not overwritten until you have chosen.

  1. Choose for each file: “Keep local” keeps your version and commits it, “Use GitHub version” replaces your file, “Keep both” keeps your file and saves the GitHub version next to it under a name such as main.remote-3f9c2ab.tex.

    The dialog "Resolve conflicts" with the file main.tex and the three choices "Keep local", "Use GitHub version" and "Keep both".
  2. Click “Apply & sync”. The sync runs again with your choices.

Open a repository as a new project

  1. On the start screen of web mode, click “Open from GitHub”.

    The buttons of the start screen with "Open from GitHub" outlined, between "Upload" and "Blank project".
  2. Pick the repository and the branch and click “Import as new project”. The editor downloads the files into a new project that is already linked, so the next sync goes to the same repository.

    The dialog "Open project from GitHub" with a list of three repositories, the branch "main" and the button "Import as new project".

What is synced and what is not

Build files stay out of the repository: .aux, .log, .out, .toc, .bbl, .bcf, .synctex.gz and similar ones, and the folder output/. A file larger than 25 MB is skipped, and the panel says how many files were skipped.

“Unlink repository” ends the link and leaves your files and the repository as they are. The sync exists in web mode only; in bridge mode your files are on your disk, where Git itself can manage them.

Where it works

What you need

Related pages