Mutagen tutorial: syncing files easily with a remote server
What if you could enjoy the computing power of a remote server in the comfort of your laptop? In this article, I'll show you how to use Mutagen to enable bidirectional sync between your local computer and a remote server. Every time you edit a file on either computer, it'll be synced to the other.
To get this running, we only need to install Mutagen on our local machine. Installations instructions are available here, for Mac OS for instance:
brew install mutagen-io/mutagen/mutagen
Starting a sync
To start a sync, simply run:
mutagen sync create --name=backend ~/Documents/backend firstname.lastname@example.org:/home/user/backend
To monitor sync constantly you can use:
mutagen sync monitor
Sync conflicts can occur from time to time. To resolve them simply delete the file from the host or the target. You can list conflicts by running
mutagen sync list
Creating a config file
By default, Mutagen will sync everything. While you can run it with arguments, I'd suggest using a config file. Create a file in
~/.mutagen.yml and add the following content:
sync: defaults: ignore: vcs: true paths: - "node_modules" - "*.ckpt" - ".DS_Store" - "__pycache__" - ".idea" - ".ipynb_checkpoints"
This way, you'll be able to handle version control on your local machine and you'll avoid sync conflicts with git files.