The examples show GitLab but of course work equally well with GitHub/Bitbucket/etc. Do not simply drag and drop the LaTeX directory into Dropbox–syncing errors will result.
Git is designed to make simultaneous pushes to multiple remotes. Backup to several sources at once such as LaTeX with Dropbox as backup to GitHub / GitLab, OneDrive or Google Drive with the syncing clients installed.
Given a LaTeX document connected to a GitLab repo, cloned to the computer, backup the 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, edit the repo’s Git config directly to get rid of errant
git -C <repo_dir> config --edit
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