Synchronization

If you keep your notebooks in Git repositories, you may use git-sync to synchronize them. zet sync is a command which you should use each time you want to synchronize.

The prerequisite for all below methods is that git-sync script is downloaded and installed in your $PATH.

Existing Remote Repositories

If you have a remote Git repository which you'd like to automatically download when you invoke zet sync, you can configure it in .zet/zet.toml.

  1. Add configuration for the new notebook to .zet/zet.toml. Point remote field to Git address you would like to fetch.

    [[notebooks]]
    name = "My Synchronized Notebook"
    path = "my-notebook"
    remote = "ssh://git@example.com/my-notebook.git"
    
  2. Run zet sync

Existing Notebook

If you already have a notebook, you can synchronize it with Git simply by making sure that it points to the remote Git repository.

  1. Initialize local Git repository

    $ cd notebook
    $ git init
    $ git add *.md
    $ git commit -m "Initialize notebook"
    
  2. Initialize remote

    $ git remote add origin <url>
    
  3. Configure git-sync

    $ git config.branch.master.sync true
    $ git config.branch.master.syncNewFiles true
    
  4. Run zet sync

  5. (optional, but recommended) Add remote field to notebook's section in .zet/zet.toml to easy and fast cloning in the future.

Local Only Notebooks

This is a variation of Existing Notebook method which stores notebook in local Git repository. There isn't any remote configured, so all notes stay locally on your computer. Notes are automatically committed during zet sync.

  1. Initialize local Git repository

    $ cd notebook
    $ git init
    $ git add *.md
    $ git commit -m "Initialize notebook"
    
  2. Run zet sync