A tool to locally synchronize your hackmd notes. Experimental: use at your own risk, but report bugs!
- Generate a Hackmd token,
<token>
- Create a directory (and make it readable by the docker container)
$ mkdir .git_md
$ chmod a+rw .git_md # Could be more specific to the docker container
- Start the docker image,
$ docker run --rm -v ~/.git_md:/home/git -p 2222:22 panglesd/git_md
3.5. Ssh into the docker container to set up some things ...
$ ssh git@localhost -p 2222
$ git config --global user.email "[email protected]"
$ git config --global user.name "Your Name"
$ exit
`
- Clone your hackmd, for instance into the
hackmd
directory
$ git clone ssh:https://git@localhost:2222/home/git/<token> hackmd
Now, each git pull
will pull your notes from hackmd (as a single commit) and each push
will update the notes (if your local repo is up to date)
git_md
can work on two setup:
- local modes, where
git-md pull -t <token>
andgit-md push -t <token>
will pull and push your notes back and forth your computer and the hackmd instance. Uses timestamps to not send and receive too many notes. Use with care, conflicts are not detected at all! - git mode, with
git-md upload-pack
andgit-md receive-pack
replacing the server-side git commands, to have a git server as a gateway to your hackmd notes.
The docker image is a simple ssh server where the git upload-pack
and git receive-pack
have been replaced by their git-md
counterpart.
TODO: explain how it works under the hood.