For practical purposes, Git over HTTPS works with Overleaf if others aren’t editing the same document at the same time via the web interface. Overleaf has a single Git branch and requires a linear Git commit history (no force Git push). If other users are using the normal web interface of Overleaf to edit the same document, Git merge will be frequently needed on local Git, which may be inconvenient. Practically speaking, if coworkers on the same Overleaf LaTeX document are using Git to push local edits, and they use Overleaf just to view, it can work OK.
The Git repo URL is given from the Overleaf project, under Menu → Sync → Git. The Git URL is a long hexadecimal number. As usual with Git, clone to a human-friendly directory name like “paper1”.
git clone https://git.overleaf.com/<hash> paper1
Some Overleaf projects may be large (100s of MB) and can take minutes to download. To show progress while Git cloning in general, add the –verbose “git clone” option.
Store Overleaf username for Git operations. Use the same email address as Overleaf login.
git config credential."https://git.overleaf.com".username email@example.com
Computer-wide Git pre-commit hooks may be bothersome when uploading. To disable Git pre-commit hooks for the repo:
git config core.hooksPath " "
For non-public Overleaf projects the Overleaf password is required for Git operations.
If a Git credential helper was previously setup, it may need to be disabled for the Overleaf repo if caching is not desired.
git config credential.helper " "
Git can use HTTPS credential cache mechanisms–on Windows consider Microsoft Git Credential Manager. A Git credential cache can avoid typing the password for each remote Git operation. The command below remembers the Git HTTPS password for 300 seconds (5 minutes).
git config credential.helper 'cache --timeout=300'
Since Overleaf Git tracking is limited, one may wish to disable GPG signing to avoid the burden of typing the additional GPG password on Git commit. As usual, this can be done on a per-Git-repo basis like:
git config commit.gpgsign false