I am a PhD student. Of course, I write papers. For various reasons, my supervisors and I use Overleaf, which is satisfactory in terms of UX and such.

However, outside of periods with high editing contention, I would rather work with my usual workflow of editing LaTeX with neovim, which I have customized to compile and lint LaTeX code for me. I find writing lengthy pieces of text more relaxing in a terminal. 🤷

Overleaf has a synchronization feature over git. You can choose to have your project synchronized over a GitHub project, a DropBox, or anything that uses git. For multiple reasons, I avoid the first two.

If you go to the project menu (with the leaf symbol, on the top left), select "Git" in the "Sync" options, you will be presented with a URL like below, and something about "Git authentication token":

https://git@git.overleaf.com/<long string of numbers>

The Problem with Overleaf's Git Tokens

Git Authentication Tokens are generated in your user settings in the "Project Synchronization" section under "Git Integration". They are shown once, kind of like most tokens. Creating one with "Add another token" leaves you with a long string that starts with something like olp_7d.....

Using passwords over git is generally a hassle, but Overleaf gives you no other choice. Of course, not content with that prospect, I poked around and played with my Git Forge to try and see if I could create a workaround.

Working Around Password Auth: Forgejo Push Mirrors

The goal: work on my paper like any regular Git repository.

To get to that goal, I want to be able to push to a remote that I have configured in my .ssh/config. My own forge is configured already, so I decided to use it.

I created a private repository for my paper, and added it as a remote of the local clone I had made of the work already done (so I had to git-clone once with the HTTPS URL and token). Then, I went into "Settings" for that repository, and under "Mirror Settings", I added a new push mirror. Its URL is the HTTPS URL shown by Overleaf, and in the "Authorization" section, I set the username to git, and the password to the token. I enabled "Sync when commits are pushed", of course, and voilà!

Essentially, this uses your forge as a proxy to store your token, so you may want to create one specifically for it. You can lower the mirror sync interval for finer granularity of updates if you plan on never pulling from the Overleaf repository. However, no matter how low you set the time, you will lag behind anyone who is using Overleaf to edit the files there. Furthermore, if a conflict arises, I am not exactly sure how Forgejo handles it. If I find out, I will update this.