Sparkleshare to sync org files
Org mode on Debian
One of my laptops runs Debian, on this machine I have installed Emacs to use org mode.
For this I have created a directory $HOME/.org, and set this in my .emacs file.
(setq org-directory "~/.org/") (setq org-default-notes-file (concat org-directory "/todo.org"))
Sparkleshare is a great solution to automatically sync files. It uses a standard Git server as back-end.
On Debian, installing Sparkleshare is just a matter of
apt-get install sparkleshare
Sparkleshare and the i3 window manager
I am running the i3 window manager and when I start Sparkleshare, an applet shows up in the systemtray.
Migrating to Sparkleshare
The first time Sparkleshare is started, it creates a new ssh key. The Sparkleshare applet in your system tray has a menu entry called "Computer ID". This is the publlc key of that newly generated ssh key.
Copy this key to a file in your Gitolite keys directory. Open the gitolite.conf file and add this key with RW+ rights to a repo. I used my orgfiles-repo for this.
Commit the key and config change and push this to the Gitolite server in the normal way.
Adding the Gitolite repo to Sparkleshare
Open the menu from the Sparkleshare applet and open "Sync remote project".
In the address field add the following:
- gitolite-user: the username for Gitolite, perhaps git or gitolite3
- gitoliteurl: the url of ip address of your gitolite server
- :port: if gitolite doesn't run on port 22, than define the port here
In the remote path field add the name of the existing repo (where you just have added RW+ rights for the Sparkleshare ssh key).
Check the box 'fetch prior revisions' if you have indeed an existing repository with already some committed files.
Hit the "Add" button and be prepared for a very long wait. Sparkleshare is now doing its magic, but that takes time.
Symlink your org directory to the new location
Sparkleshare has created a directory in your $HOME directory, called SparkleShare. In here you find a subdirectory with the name of your Git server or Gitolite server, and in there you find the name of your Git repository, and in there the files that Sparkleshare has just checked out of your Git repository.
If everything worked out fine, you can remove your current org directory and symlink it to the new location in your $HOME/SparkleShare directory.
Automatically start Sparkleshare
I have added a line to my .xsessionrc to start Sparkleshare automatically when starting X.
Automated check in of your work
When you add content to your org files, add new org files to your org directory or change existing content, Sparkleshare will take care of the changes and submit those to your Git repository in Gitolite.