The examples show GitLab but of course work equally well with GitHub/Bitbucket/etc. Do not simply drag and drop your LaTeX directory into Dropbox–you will get syncing errors!
Git is designed to make simultaneous pushes to multiple remotes. You could backup to several sources at once such as LaTeX with Dropbox as backup to GitHub / GitLab, OneDrive or Google Drive with their syncing clients installed.
Given a LaTeX document connected to a GitLab repo, cloned to your computer, backup your LaTeX document folder somewhere else now as a precaution.
git LaTeX repo ↔ Dropbox:
git push will go to both simultaneously.
Check current LaTeX repo
cd ~/Dissertation git remote -v
origin https://gitlab.com/username/MyDiss (fetch) origin https://gitlab.com/username/MyDiss (push)
Create a directory in your Dropbox folder that is just for your LaTeX Git repos–you can keep multiple LaTeX projects in one Dropbox directory. Let’s call it
Now setup that Dropbox/Git directory as a second push-only remote. You won’t see your files in there because it’s a “bare” Git repo, but the history of all your files are recoverable from it in case your LaTeX git history gets messed up.
cd ~/Dropbox/Git git clone --bare https://gitlab.com/username/MyDiss cd ~/Dissertation git remote set-url origin --push --add ~/Dropbox/Git/Dissertation.git git remote set-url origin --push --add https://gitlab.com/username/MyDiss.git
--push says this is just for pushing, not for fetching–we’ll normally fetch (pull) from GitLab since Dropbox is just for rolling backup.
Verify setup by
git remote -v
origin https://gitlab.com/username/MyDiss (fetch) origin https://gitlab.com/username/MyDiss (push) origin /home/computerusername/Dropbox/Git (push)
If you have issues, you can edit
.git/config directly to get rid of errant
%userprofile% is equivalent to
~ on MacOS/Linux.
Power users of Windows might like to access this setup from WSL.
Since Windows Command Prompt doesn’t understand
~, you will have to make sure each Terminal you use has softlinks created at the same link_name.
The absolute pathnames are different for WSL, but the softlinks can look the same.
Windows Subsystem for Linux:
cd ~ ln -s /mnt/c/users/joe/Dropbox
Related: LaTeX with GitLab/GitHub and Dropbox PDF sharing