From 9ef311d868248682a11c8cb8c0177bc9949be7b9 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 20 Mar 2014 01:33:18 -0600 Subject: git: sign commits if enabled --- man/pass.1 | 7 +++++-- src/password-store.sh | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/man/pass.1 b/man/pass.1 index 6555ca0..2b3e5e3 100644 --- a/man/pass.1 +++ b/man/pass.1 @@ -1,4 +1,4 @@ -.TH PASS 1 "2012 Sept 24" ZX2C4 "Password Store" +.TH PASS 1 "2014 March 18" ZX2C4 "Password Store" .SH NAME pass - stores, retrieves, generates, and synchronizes passwords securely @@ -118,7 +118,10 @@ If the password store is a git repository, pass \fIgit-command-args\fP as argume .BR git (1) using the password store as the git repository. If \fIgit-command-args\fP is \fBinit\fP, in addition to initializing the git repository, add the current contents of the password -store to the repository in an initial commit. +store to the repository in an initial commit. If the git config key \fIpass.signcommits\fP +is set to \fItrue\fP, then all commits will be signed using \fIuser.signingkey\fP or the +default git signing key. This config key may be turned on using: +.B `pass git config --bool --add pass.signcommits true` .TP \fBhelp\fP Show usage message. diff --git a/src/password-store.sh b/src/password-store.sh index f7ad52b..a5d3374 100755 --- a/src/password-store.sh +++ b/src/password-store.sh @@ -69,7 +69,8 @@ git_add_file() { [[ -d $GIT_DIR ]] || return git add "$1" || return [[ -n $(git status --porcelain "$1") ]] || return - git commit -m "$2" + [[ $(git config --bool --get pass.signcommits) == "true" ]] && sign="-S" || sign="" + git commit $sign -m "$2" } yesno() { read -r -p "$1 [y/N] " response -- cgit v1.2.3-54-g00ecf