From 47859cb4f774d0ca3df45a2fc29707da71ab2d5e 2020-06-29 04:18:12
From: Branko Majic <branko@majic.rs>
Date: 2020-06-29 04:18:12
Subject: [PATCH] Make sure that when exporting a public key only one specific subkey is exported. Fixed a typo in error message.

---

diff --git a/openpgp/gitprotect.sh b/openpgp/gitprotect.sh
index 5f149240ae87469e3fb2851a1a81d3f077e05789..f18db01f3ef7d395eb52987f5121453533e271d4 100755
--- a/openpgp/gitprotect.sh
+++ b/openpgp/gitprotect.sh
@@ -255,7 +255,7 @@ elif [[ $command == "addkey" ]]; then
             if ! gpg2 --batch --list-keys "$key" >/dev/null 2>&1; then
                 echo "WARN: Key with identifier '$key' not found in user's GnuPG keyring. Skipping." >&2
             else
-                ! gpg2 --batch --armor --export "$key" | gpg2 "${gnupgArgs[@]}" --import
+                ! gpg2 --batch --armor --export "${key}!" | gpg2 "${gnupgArgs[@]}" --import
                 if [[ ${PIPESTATUS[0]} != 0 ]]; then
                     echo "ERROR: Failed to add key with identifier '$key')." >&2
                 fi
@@ -303,7 +303,7 @@ elif [[ $command = "encrypt" ]]; then
 
     # Make sure that we have at least a single recipient.
     if [[ "${#recipients[@]}" == 0 ]]; then
-        echo "ERROR: No suitable recipients were found in the keyring. Did you forget ot add keys?" >&2
+        echo "ERROR: No suitable recipients were found in the keyring. Did you forget to add keys?" >&2
         exit "$ERR_NORECIPIENTS"
     fi