history-sync
An Oh My Zsh plugin for GPG encrypted, Internet synchronized Zsh history using Git.
Usage
Before history-sync can be useful, you need two things:
- A hosted git repository, e.g. GitHub, Bitbucket
- Ideally with ssh key access
- A configured gpg key pair for encrypting and decrypting your history file and the enrolled public keys of all the nodes in your web of trust
- See the GnuPG documentation for more information since it's outside the scope of this README
Once you have these things in place, it's just a matter of updating the needed environment variables to suit your configuration:
- ZSHHISTORYFILE: your zsh_history file location
- ZSHHISTORYPROJ: your git project for housing your zsh_history file
- ZSHHISTORYFILEENC: your encrypted zshhistory file location
- GITCOMMITMSG: your default message when pushing to $ZSHHISTORYPROJ
Which have the following defaults:
ZSH_HISTORY_FILE_NAME=".zsh_history"
ZSH_HISTORY_FILE="${HOME}/${ZSH_HISTORY_FILE_NAME}"
ZSH_HISTORY_PROJ="${HOME}/.zsh_history_proj"
ZSH_HISTORY_FILE_ENC_NAME="zsh_history"
ZSH_HISTORY_FILE_ENC="${ZSH_HISTORY_PROJ}/${ZSH_HISTORY_FILE_ENC_NAME}"
GIT_COMMIT_MSG="latest $(date)"
and running the commands:
# pull history
zhpl
# push history
zhps -r "John Brown" -r 876T3F78 -r ...
# pull and push history
zhsync
Demo
Check out the screen cast.
Licence
MIT @ James Fraser