aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Documentation/config.txt7
-rw-r--r--Documentation/git-tag.txt10
-rwxr-xr-xgit-tag.sh6
3 files changed, 21 insertions, 2 deletions
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 3f2fa09a8..6ea7c76a6 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -469,6 +469,13 @@ user.name::
Can be overridden by the 'GIT_AUTHOR_NAME' and 'GIT_COMMITTER_NAME'
environment variables. See gitlink:git-commit-tree[1].
+user.signingkey::
+ If gitlink:git-tag[1] is not selecting the key you want it to
+ automatically when creating a signed tag, you can override the
+ default selection with this variable. This option is passed
+ unchanged to gpg's --local-user parameter, so you may specify a key
+ using any method that gpg supports.
+
whatchanged.difftree::
The default gitlink:git-diff-tree[1] arguments to be used
for gitlink:git-whatchanged[1].
diff --git a/Documentation/git-tag.txt b/Documentation/git-tag.txt
index 13c7aefbf..3f01e0bfc 100644
--- a/Documentation/git-tag.txt
+++ b/Documentation/git-tag.txt
@@ -70,6 +70,16 @@ OPTIONS
Take the tag message from the given file. Use '-' to
read the message from the standard input.
+CONFIGURATION
+-------------
+By default, git-tag in sign-with-default mode (-s) will use your
+committer identity (of the form "Your Name <your@email.address>") to
+find a key. If you want to use a different default key, you can specify
+it in the repository configuration as follows:
+
+[user]
+ signingkey = <gpg-key-id>
+
Author
------
Written by Linus Torvalds <torvalds@osdl.org>,
diff --git a/git-tag.sh b/git-tag.sh
index 94499c9b3..988bf4c6a 100755
--- a/git-tag.sh
+++ b/git-tag.sh
@@ -112,7 +112,9 @@ git-check-ref-format "tags/$name" ||
object=$(git-rev-parse --verify --default HEAD "$@") || exit 1
type=$(git-cat-file -t $object) || exit 1
tagger=$(git-var GIT_COMMITTER_IDENT) || exit 1
-: ${username:=$(expr "z$tagger" : 'z\(.*>\)')}
+
+keyid=$(git-repo-config user.signingkey) ||
+ keyid=$(expr "z$tagger" : 'z\(.*>\)')
trap 'rm -f "$GIT_DIR"/TAG_TMP* "$GIT_DIR"/TAG_FINALMSG "$GIT_DIR"/TAG_EDITMSG' 0
@@ -139,7 +141,7 @@ if [ "$annotate" ]; then
cat "$GIT_DIR"/TAG_FINALMSG ) >"$GIT_DIR"/TAG_TMP
rm -f "$GIT_DIR"/TAG_TMP.asc "$GIT_DIR"/TAG_FINALMSG
if [ "$signed" ]; then
- gpg -bsa -u "$username" "$GIT_DIR"/TAG_TMP &&
+ gpg -bsa -u "$keyid" "$GIT_DIR"/TAG_TMP &&
cat "$GIT_DIR"/TAG_TMP.asc >>"$GIT_DIR"/TAG_TMP ||
die "failed to sign the tag with GPG."
fi