]> gitweb.fluxo.info Git - keyringer.git/commitdiff
Check git configuration
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 14 Mar 2014 13:53:09 +0000 (10:53 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 14 Mar 2014 13:53:09 +0000 (10:53 -0300)
keyringer

index da876788d94b528d3e6ff9484bb40f52530d0f3b..161ab5ed32dc8eef37415f3a68dc96b19eea68b6 100755 (executable)
--- a/keyringer
+++ b/keyringer
@@ -39,6 +39,18 @@ function keyringer_init {
     exit 1
   fi
 
+  # Check user configuration: git might complain if those aren't set
+  if [ -z "`git config --global --get user.name`" ] || [ -z "`git config --global --get user.email`" ]; then
+    echo "Please chose the name and email address that should identify your changes in the new keyring."
+    read -p "Enter your desired name/pseudonym: " name
+    read -p "Enter your desired email address: " email
+
+    if [ -z "$name" ] || [ -z "$email" ]; then
+      echo "Aborting."
+      exit 1
+    fi
+  fi
+
   # Setup
   if [ ! -z "$URL" ]; then
     git clone "$URL" "$BASEDIR"
@@ -93,6 +105,10 @@ function keyringer_init {
     keyringer_exec git "$BASEDIR" init
     keyringer_git_ignore 'tmp/*'
 
+    # Git configuration
+    git config user.email "$email"
+    git config user.name  "$name"
+
     # Edit default recipients
     echo "Now you have to edit the default recipient configuration to be able to encrypt secrets."
     echo "Press any key to proceed editing..."
@@ -161,7 +177,7 @@ fi
 # Load functions
 source "$LIB" || exit 1
 
-# Check if keyring exist
+# Check if keyring exists
 if [ ! -f "$CONFIG_BASE/$KEYRING" ] && [ "$ACTION" != "init" ]; then
   echo "No such keyring $KEYRING"
   exit 1