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 remote masters. You could backup to several sources at once. Here’s a simple case of using LaTeX with Dropbox as backup to Github. (The same process can be used with OneDrive or Google Drive as well when you have their syncing clients installed.)
We assume you already have a LaTeX document connected to a Github repo, cloned to your computer. Backup your LaTeX document folder somewhere else now as a precaution.
Connect Github LaTeX repo to Dropbox backup, pushing to both simultaneously
check your current LaTeX repo
cd ~/MyDissertation git remote -v
You should see:
origin https://github.com/githubusername/MyDiss (fetch) origin https://github.com/githubusername/MyDiss (push)
Create a directory in your Dropbox folder that is just for your Overleaf Git repos–you can keep multiple Overleaf 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 (as has happened to me with Overleaf!).
cd ~/Dropbox/Git git clone --bare https://github.com/githubusername/MyDiss cd ~/OverleafDissertation git remote set-url origin --push --add ~/Dropbox/Git/MyDiss.git git remote set-url origin --push --add https://github.com/githubusername/MyDiss.git
--pushsays this is just for pushing, not for fetching–we’ll normally fetch (pull) from Github since Dropbox is just for rolling backup.
Verify setup by
git remote -v
and you should see:
origin https://github.com/githubusername/MyDiss (fetch) origin https://github.com/githubusername/MyDiss (push) origin /home/computerusername/Dropbox/Git (push)
If you have issues, you can edit
.git/config directly to get rid of errant
Note for Windows
%userprofile% is equivalent to
~ on Mac/Linux.
Special note only for Windows Subsystem for Linux or Cygwin users
Power users of Windows might like to access this setup from WSL or Cygwin. Since Windows Command Prompt doesn’t understand “~”, you will have to make sure each Terminal you use (WSL, Cygwin) have softlinks created at the same link_name. Yes, the absolute pathnames are different between WSL and Cygwin, but the softlinks can look the same.
cd ~ ln -s /cygdrive/c/users/joe/Dropbox
cd ~ ln -s /mnt/c/users/joe/Dropbox
In general I only push/pull from Cygwin or WSL when on a Windows PC because I use SSH on my Git repos with public key authentication.