Skip to content

Commit 049ad18

Browse files
committed
Merge branch 'master' of github.com:HugoJH/git-clone-init into HugoJH-master
* 'master' of github.com:HugoJH/git-clone-init: Fixed README Added configuration of gpg indentity
2 parents ffd0188 + 54fcc0a commit 049ad18

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
![Screenshot of a git clone](/about.png)
44

55
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.
6+
Optionally, also `user.signingkey` can be configured.
67

78
## Installation
89

@@ -28,10 +29,10 @@ You can use the file `git-clone-init` as a starting point. Keep in mind to creat
2829
Example:
2930
```bash
3031
case "$url" in
31-
*@github.com:* ) email="my-public@email"; name="public name";;
32-
*//github.com/* ) email="my-public@email"; name="public name";;
33-
*@corp.com:* ) email="my-corporate@email"; name="real name";;
34-
*//corp.com/* ) email="my-corporate@email"; name="real name";;
32+
*@github.com:* ) email="my-public@email"; name="public name"; gpgid="GPG ID";;
33+
*//github.com/* ) email="my-public@email"; name="public name"; gpgid="GPG ID";;
34+
*@corp.com:* ) email="my-corporate@email"; name="real name"; gpgid="GPG same/other ID";;
35+
*//corp.com/* ) email="my-corporate@email"; name="real name"; gpgid="GPG same/other ID";;
3536
esac
3637
```
3738

git-clone-init

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

33
case "$url" in
4-
*@github.com:* ) email=""; name="";;
5-
*//github.com/* ) email=""; name="";;
4+
*@github.com:* ) email=""; name=""; gpgid="";;
5+
*//github.com/* ) email=""; name=""; gpgid="";;
66
esac

post-checkout

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ cat << INPUT > "$configpath"
3434
#!/bin/bash
3535
3636
case "\$url" in
37-
*@github.com:* ) email=""; name="";;
38-
*//github.com/* ) email=""; name="";;
37+
*@github.com:* ) email=""; name=""; gpgid="";;
38+
*//github.com/* ) email=""; name=""; gpgid="";;
3939
esac
4040
INPUT
4141
warn "\nMissing file $configpath. Template created..."
@@ -52,3 +52,10 @@ git config --local user.email "$email"
5252
git config --local user.name "$name"
5353

5454
echo -e "\nLocal identity for ${PWD##*/} set to \"$name <$email>\""
55+
56+
if [[ ! -z $gpgid ]]; then
57+
git config commit.gpgsign true
58+
git config user.signingkey $gpgid
59+
60+
echo -e "\n Repo configured to use $gpgid GPG Identity"
61+
fi

0 commit comments

Comments
 (0)