diff --git a/README.md b/README.md index 15c7042..ed76605 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ ![Screenshot of a git clone](/about.png) Whenever a repository is cloned, author information (`user.email`, `user.name`) is set according defined patterns. No longer pushing commits with your corporate email address by accident. +Optionally, also `user.signingkey` and `commit.gpgsign` can be configured independently. Corresponding variablels `gpgid` and `gpgsign` might be set or omitted. ## Installation @@ -30,8 +31,8 @@ Example: case "$url" in *@github.com:* ) email="my-public@email"; name="public name";; *//github.com/* ) email="my-public@email"; name="public name";; - *@corp.com:* ) email="my-corporate@email"; name="real name";; - *//corp.com/* ) email="my-corporate@email"; name="real name";; + *@corp.com:* ) email="my-corporate@email"; name="real name"; gpgid="GPG ID"; gpgsign="true/false";; + *//corp.com/* ) email="my-corporate@email"; name="real name"; gpgid="GPG ID"; gpgsign="true/false";; esac ``` diff --git a/git-clone-init b/git-clone-init index 4cae6b7..99093f0 100644 --- a/git-clone-init +++ b/git-clone-init @@ -1,5 +1,9 @@ #!/bin/bash +#You can also provide the following variables: +# gpgid ID of an gpg key configuration of user.signingkey +# gpgsign true/false configuration of commit.gpgsign + case "$url" in *@github.com:* ) email=""; name="";; *//github.com/* ) email=""; name="";; diff --git a/post-checkout b/post-checkout index 7d248eb..69cb65e 100755 --- a/post-checkout +++ b/post-checkout @@ -33,6 +33,10 @@ if [[ ! -f "$configpath" ]]; then cat << INPUT > "$configpath" #!/bin/bash +#You can also provide the following variables: +# gpgid ID of an gpg key configuration of user.signingkey +# gpgsign true/false configuration of commit.gpgsign + case "\$url" in *@github.com:* ) email=""; name="";; *//github.com/* ) email=""; name="";; @@ -52,3 +56,15 @@ git config --local user.email "$email" git config --local user.name "$name" echo -e "\nLocal identity for ${PWD##*/} set to \"$name <$email>\"" + +if [[ ! -z $gpgid ]]; then + git config user.signingkey "$gpgid" + + echo -e "\n Repo configured to use $gpgid GPG Identity" +fi + +if [[ ! -z $gpgsign ]]; then + git config commit.gpgsign "$gpgsign" + + echo -e "\n Repo configured to use commit.gpgsign=$gpgsign" +fi