Syncing your project to a git remote
TeXType already keeps a project's history as commits in its own git repository. Sync copies that history to a repository you control (on GitHub or GitLab, for example) shortly after you save. That gives you a backup outside TeXType that you can clone, read and keep.
Sync is part of Pro, and only a project's owners can set it up. Cloning straight from TeXType (below) works on every plan, and pushing to it (below) on Pro.
Pulled commits keep their authors, and History marks each one pulled from GitHub by (or GitLab) the owner who linked the repository. Anyone who can write to that repository can write any name in a commit, so an author is shown as a member of the project only when the address is that owner's own; any other name and address is shown as written in the commit.
1 · Create a repository to sync into
- On GitHub: New repository, private, any name.
- Create it empty: do not tick "Add a README". An empty repository accepts the first push cleanly. Sync does not create repositories itself.
If you sync into a repository that already has history, do not use its
existing branch: in step 3, set the branch to an unused name such as
textype. The Check target button in the sync dialog
tells you whether your choice is safe before anything is pushed.
2 · Create a fine-grained personal access token
A fine-grained token can be limited to exactly one repository with exactly one permission, so a leak of this credential exposes only this backup — not your account.
- On GitHub, open Settings → Developer settings → Personal access tokens → Fine-grained tokens → Generate new token.
- Resource owner: you (or the organization that owns the repository).
- Expiration: your choice; a year is reasonable. You do not need to note the date: the project's sync indicator turns amber two weeks before the token expires (the dialog shows the day), and pasting a new token fixes it.
- Repository access: Only select repositories → pick the repository from step 1.
- Permissions → Repository permissions → Contents: Read and write. (Metadata: read-only is added automatically.) Nothing else is needed.
- Generate the token and copy it: GitHub shows it only once.
repo scope
works everywhere but grants access to every repository you can reach — scope
it mentally as "my whole account" and store it nowhere else. For SAML/SSO
organizations, remember to click Authorize for the org after
creating a classic token.
3 · Connect it in the sync dialog
- Paste the token into Access token and click
Save token and browse. Pick your repository from the
list, and the URL and branch are filled in.
(Or paste the repository's
https://…URL by hand.) - Leave Username blank: GitHub ignores it when you use a personal access token. (GitLab wants your username there; see GitLab below.)
- Branch:
mainfor an empty repository; an unused name liketextypeotherwise. - Click Check target and read what it says.
- Leave Push automatically after every save on (it is the default), then click Save, then Push now.
- Refresh the repository on GitHub: your project's full history is there.
From then on, edits are pushed automatically: about ten seconds after a save, one push carries everything since the last one. The dialog's status line shows the last pushed commit, and any failure with its reason. Most failures are retried automatically; a rejected token or a missing repository waits until you change the sync settings.
Where the token lives
The token is encrypted on the server the moment it is saved and is never sent back to any browser — the dialog can only replace it, not reveal it. Even so, scope tokens minimally: one repository, contents-only, with an expiry.
When it breaks later
- "The remote rejected the credentials": the token expired or was revoked. Create a new one (step 2), paste it into the token field, and Save; every other field can stay as it is.
- "The remote has commits this project does not": someone committed directly to the synced branch on GitHub. See fixing a branch that was pushed to by accident, just below.
- Host unreachable: there is nothing to do. Pushes are retried and catch up on their own.
- "The repository has a symbolic link (…)" or "… a submodule (…)": a pull brings in neither, because TeXType keeps only real files. Put the file itself in its place on GitHub, or remove it, and pull again. A project that already held a submodule leaves it out from its next save, and sync then removes it on GitHub too.
Fixing a branch that was pushed to by accident
Pushes stop with "the remote has commits this project does not" when something reached the synced branch from outside the editor, such as an edit made directly on GitHub or a push from a clone. The Pull button in the sync dialog resolves this (by merging, or by using the remote's history). If you would rather fix it by hand, there are two ways, the safer first.
Option 1: sync to a new branch. This leaves the old branch as it is:
- In the sync dialog, change Branch to an unused name
(such as
backup-2). - Save, then Push now. The project's full history lands on the new branch.
- The old branch stays on GitHub as it was. If the stray commits contain anything worth keeping, read them there and paste what you need into the editor.
Option 2: keep the branch name by resetting it. This removes the stray commits from GitHub, so first save what you need from them:
- If anything in the stray commits matters, bring it in through the editor: view the commit on GitHub and paste the changes into the project. The editor's copy is the one that counts.
- On GitHub, delete the synced branch: repository → Branches → 🗑. If GitHub refuses because it is the repository's default branch, first switch the default to any other branch (Settings → General → Default branch; if there is no other branch, create one on GitHub first), then delete the synced branch.
- Back in the editor, click Push now. The branch is recreated with the project's full history, and automatic pushes resume.
GitLab
The same three steps, with GitLab's names for things. This works for gitlab.com and for a self-hosted GitLab whose address contains "gitlab" (such as gitlab.example.edu), since the sync dialog recognizes GitLab from the URL. For a GitLab at another address, paste the clone URL and use Check target; browsing is not available there.
- Create an empty project on GitLab: New project → Create blank project, private, and untick Initialize repository with a README.
- Create a personal access token: your
avatar → Preferences → Access tokens → Add new token. Scopes:
read_repositoryandwrite_repository. Nothing else is needed. Set an expiry; the sync indicator warns two weeks before it lapses. - In the sync dialog: first paste the new project's HTTPS clone URL (on GitLab, Code → Clone with HTTPS) into Remote URL. A blank Remote URL means GitHub, so the dialog would send your GitLab token there. Username is your GitLab username (the one in your profile URL, not your email), and the token goes in Access token. Then Save; Save token and browse lists your GitLab projects if you want to pick another.
Cloning straight from TeXType
You do not need GitHub to have the project on your own machine. TeXType is itself a git remote, on every plan:
- On your account page, under Access tokens, make a token for the project. Copy it; it is shown once.
- Copy the clone command shown when you make the token (if you own the
project, it is also under Clone with git in its
Sync dialog), and run it:
git clone https://textype.io/git/<project-id>
- When git asks, give any username and the token as the password. If
your system has a credential helper, it remembers the token, so a later
git pulldoes not ask again.
The clone has the files and their whole history, including what was typed a moment ago: the project saves before git reads it. Comments and suggestions are not files and are not in the clone; they stay in TeXType.
Pushing to TeXType
On Pro, git push changes the project itself, and everyone who
has it open sees the change as it arrives. It needs a token made to
Read and push (a read token is refused), and an editor's or
owner's place in the project; the plan is the project owner's.
- Fast-forward only. A push must build on TeXType's
mainas it is now. If someone typed in TeXType since you last fetched, git refuses the push with fetch first: rungit pull, then push again. Force pushes and deletingmainare refused. - Text typed while a push arrives is kept. It is merged
with the push, as a pull from GitHub is; git reports the merge, and
git pullbrings it to you. - One branch, no tags. Push to
main(git push origin HEAD:main). Label versions in the project's History;git fetchbrings them as tags. - Refused before anything changes: a push past the
plan's storage or the project's file limit, one whose history would
grow past what the plan keeps, and files named so that a copy on
macOS or Windows could not hold them (two names differing only in
capitals,
CON.tex,a:b.tex) or that git does not allow (.git). Symbolic links and submodules are refused too, naming the path: TeXType keeps neither. Put the files themselves in the project. - Line endings as written. TeXType stores each file's
line endings exactly as they were written, and does not apply a
project's
.gitattributesline-ending rules (text,eol) or its encoding and export rules. - Your commits keep their authors, and History marks each one pushed by you. An author is shown as a member of the project only when the address is your own; any other name and address is shown as written in the commit. If sync to GitHub or GitLab is on, the push goes on there too, as a save does.
Other hosts
Browsing repositories works for GitHub and GitLab, but sync itself works
with any host that accepts an authenticated https:// push:
- Gitea / Forgejo / others: any access token that can push over HTTPS works; username requirements vary by host. Paste the clone URL and use Check target.
- Only
https://addresses are supported. SSH addresses (ssh://…orgit@host:…) are refused: TeXType cannot sync over SSH. Use the repository'shttps://address with an access token instead.
Other guides
Connect your AI tools to TeXType: connecting Claude, ChatGPT, Claude Code or Codex to your projects, and reviewing what they suggest. AI tools never push to git themselves. Where a project allows new files, a file an AI tool adds is a version like any other, so a synced project pushes it to your repository.