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
.gzg
folder innotes/
- Init a bare git repo at
.gzg/gzg.git
- Store the string
jeremy@mydomain:git/notes.gzg
into a.gzg/remote
file - Run
git init
in thenotes/
directory - Add
/.gzg
to.gitignore
- Add path to
.gzg/gzg.git
as a git remote - Add all untracked files and make a commit
- Push to the
.gzg/gzg.git
remote - Run
tar
on the.gzg/gzg.git
folder, producing.gzg/gzg.git.tar.gz
- Run
gpg
on that, producing.gzg/gzg.git.tar.gz.gpg
- Run
shasum
on that, producing.gzg/gzg.git.tar.gz.gpg.sha1
scp
the last two files to thegit/notes.gzg
folder 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
.gzg
folder innotes/
- Store the string
jeremy@mydomain:git/notes.gzg
into a.gzg/remote
file scp
thegit/notes.gzg/gzg.git.tar.gz.gpg
file from the server into.gzg
- Decrypt and untar the file, so you have a git repo at
.gzg/gzg.git
- Run
git init
in thenotes/
directory - Add path to
.gzg/gzg.git
as 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:
scp
thegit/notes.gzg/gzg.git.tar.gz.sha1
file from the server- Run
shasum
on the local.gzg/gzg.git.tar.gz
file to see if it changed - If so,
scp
thegzg.git.tar.gz.gpg
file from the server and decrypt it tar xf
thegzg.git.tar.gz
file to get agzg.git
bare repo- Add all files to the git index
- Make a commit
- Run
git pull
- Handle any merge conflicts somehow
- Run
git push
tar czvf
thegzg.git
folder to getgzg.git.tar.gz
- Encrypt that to get
gzg.git.tar.gz.gpg
- Run
shasum
on that to getgzg.git.tar.gz.gpg.sha1
scp
both those files to the server
- Maybe the
.gzg
folder could be contained within the.git
folder, so we wouldn't have to worry about having a.gitignore
? Or just make.gzg
an 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.