commit 05a219587336d51203196f5f809d1c5d9d93af7c
parent 68f910fbbe81166dfe4765bcb8a05effc444e528
Author: Jason A. Donenfeld <Jason@zx2c4.com>
Date: Sat, 22 Sep 2012 19:47:55 +0200
Allow git repo to be elsewhere via env var.
Diffstat:
2 files changed, 24 insertions(+), 9 deletions(-)
diff --git a/man/pass.1 b/man/pass.1
@@ -19,8 +19,7 @@ pass - stores, retrieves, generates, and synchronizes passwords securely
is a very simple password store that keeps passwords inside
.BR gpg (1)
encrypted files inside a simple directory tree residing at
-.IR $HOME/.password-store ,
-or the environment variable \fBPASSWORD_STORE_DIR\fP if it is set.
+.IR ~/.password-store .
The
.B pass
utility provides a series of commands for manipulating the password store,
@@ -43,8 +42,7 @@ extended description using \fBinit\fP and
The \fBinit\fP command must be run before other commands in order to initialize
the password store with the correct gpg key id. Passwords are encrypting using
-the gpg key set with \fBinit\fP, unless the \fBPASSWORD_STORE_KEY\fP environment
-variable is set to an alternative key id.
+the gpg key set with \fBinit\fP.
There is a corresponding bash completion script for use with tab completing
password names in
@@ -318,11 +316,28 @@ To kexec.com:pass-store
.TP
.B ~/.password-store
-The password storage directory.
+The default password storage directory.
.TP
.B ~/.password-store/.gpg-id
-Contains the gpg key identification used for encryption and decryption. This should
-be set using the \fBinit\fP command.
+Contains the default gpg key identification used for encryption and decryption.
+This should be set using the \fBinit\fP command.
+
+.SH ENVIRONMENT VARIABLES
+
+.TP
+.I PASSWORD_STORE_DIR
+Overrides the default password storage directory.
+.TP
+.I PASSWORD_STORE_KEY
+Overrides the default gpg key identification set by \fBinit\fP.
+.TP
+.I PASSWORD_STORE_GIT
+Overrides the default root of the git repository, which is helpful if
+\fIPASSWORD_STORE_DIR\fP is temporarily set to a sub-directory of the default
+password store.
+.TP
+.I EDITOR
+The location of the text editor used by \fBedit\fP.
.SH SEE ALSO
.BR gpg (1),
diff --git a/src/password-store.sh b/src/password-store.sh
@@ -7,11 +7,11 @@ umask 077
PREFIX="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
ID="$PREFIX/.gpg-id"
-GIT_DIR="$PREFIX/.git"
+GIT_DIR="${PASSWORD_STORE_GIT:-$PREFIX}/.git"
GPG_OPTS="--quiet --yes --batch"
export GIT_DIR
-export GIT_WORK_TREE="$PREFIX"
+export GIT_WORK_TREE="${PASSWORD_STORE_GIT:-$PREFIX}"
version() {
cat <<_EOF