gzg helps you use git, tar, and gpg to keep a folder of text files
synced across your devices using a server you have SSH access to. Each client
has a git repo containing the unencrypted text files. All the server has is the
encrypted, gzipped, tar'd, bare git repo in a single file called
gzg.git.tar.gz.gpg. There is also a gzg.git.tar.gz.gpg.sha1 file used for
the clients to check whether their version of the git repo is outdated.
Here's how you would set up a notes directory:
$ mkdir notes
$ cd notes
$ vim TODO.txt
$ gzg init jeremy@mydomain:git/notes.gzg
This would:
- Make a
.gzgfolder innotes/ - Init a bare git repo at
.gzg/gzg.git - Store the string
jeremy@mydomain:git/notes.gzginto a.gzg/remotefile - Run
git initin thenotes/directory - Add
/.gzgto.gitignore - Add path to
.gzg/gzg.gitas a git remote - Add all untracked files and make a commit
- Push to the
.gzg/gzg.gitremote - Run
taron the.gzg/gzg.gitfolder, producing.gzg/gzg.git.tar.gz - Run
gpgon that, producing.gzg/gzg.git.tar.gz.gpg - Run
shasumon that, producing.gzg/gzg.git.tar.gz.gpg.sha1 scpthe last two files to thegit/notes.gzgfolder on the server
Then, you'd want to run clone on your other devices:
$ gzg clone jeremy@mydomain:git/notes.gzg notes
$ cd notes
$ vim TODO.txt
This would:
- Make a
notes/directory - Make a
.gzgfolder innotes/ - Store the string
jeremy@mydomain:git/notes.gzginto a.gzg/remotefile scpthegit/notes.gzg/gzg.git.tar.gz.gpgfile from the server into.gzg- Decrypt and untar the file, so you have a git repo at
.gzg/gzg.git - Run
git initin thenotes/directory - Add path to
.gzg/gzg.gitas a git remote - Run
git pull
Then, whenever you make changes or want to update a device with the latest
changes, run the sync command:
$ cd notes
$ vim TODO.txt
$ gzg sync
This would:
scpthegit/notes.gzg/gzg.git.tar.gz.sha1file from the server- Run
shasumon the local.gzg/gzg.git.tar.gzfile to see if it changed - If so,
scpthegzg.git.tar.gz.gpgfile from the server and decrypt it tar xfthegzg.git.tar.gzfile to get agzg.gitbare repo- Add all files to the git index
- Make a commit
- Run
git pull - Handle any merge conflicts somehow
- Run
git push tar czvfthegzg.gitfolder to getgzg.git.tar.gz- Encrypt that to get
gzg.git.tar.gz.gpg - Run
shasumon that to getgzg.git.tar.gz.gpg.sha1 scpboth those files to the server
- Maybe the
.gzgfolder could be contained within the.gitfolder, so we wouldn't have to worry about having a.gitignore? Or just make.gzgan exception when adding all untracked files, somehow. - The user has to specify the GPG key they want to use, and it should be remembered.
- Only one device should sync at the same time. Access to the server's file should be locked somehow.