history-sync
An oh-my-zsh plugin for GPG encrypted internet synchronised Zsh history, with Git.
Shell★ 268⑂ 30 forksMITupdated 7 months ago
README.mdfork it — it’s yours
history-sync
An Oh My Zsh plugin for GPG encrypted, Internet synchronized Zsh history using Git.
Installation
sudo apt install gpg git git clone git@github.com:wulfgarpro/history-sync.git cp -r history-sync ~/.oh-my-zsh/plugins
Open .zshrc file and add history-sync to the plugins list:
plugins=(... history-sync)
The reaload Zsh:
exec zsh
Usage
Before using history-sync, ensure you have:
- A hosted Git repository, e.g. GitHub, Bitbucket, with SSH key access.
- A configured GPG key pair for encrypting/decrypting your history file, and the public keys of all
nodes in your web-of-trust.
- See the GnuPG documentation for details.
Once set up, configure the following environment variables:
ZSH_HISTORY_FILE: yourzsh_historyfile locationZSH_HISTORY_PROJ: Git project for storingzsh_historyZSH_HISTORY_FILE_ENC: encrypted history file locationZSH_HISTORY_COMMIT_MSG: default commit message when pushingZSH_HISTORY_DEFAULT_RECIPIENT: default recipient forzhps
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}"
ZSH_HISTORY_COMMIT_MSG="latest $(date)"
ZSH_HISTORY_DEFAULT_RECIPIENT=""
Optional:
ZSH_HISTORY_GIT_REMOTE: if set, the plugin clones the remote repo on first use
Commands
# Pull history zhpl # Push history zhps -r "John Brown" -r 876T3F78 -r ... # Or set a default recipient to omit -r: # ZSH_HISTORY_DEFAULT_RECIPIENT="John Brown" # Pull + push history zhsync
Demo
Check out the screen cast.
Licence
MIT @ James Fraser
more like this