Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .git-clone-init
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

case "$url" in
*@github.com:* ) email=""; name="";;
*//github.com/* ) email=""; name="";;
*@github.com:* ) email=""; name=""; gpgid="";;
*//github.com/* ) email=""; name=""; gpgid="";;
esac
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,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.
Whenever a repository is cloned, author information (user.email, user.name, user.signingkey) is set according defined patterns. No longer pushing commits with your corporate email address by accident.

## Installation

Expand All @@ -28,10 +28,10 @@ You can use the file ".git-clone-init" as a starting point. Keep in mind to crea
Example:
```bash
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";;
*@github.com:* ) email="my-public@email"; name="public name"; gpgid="GPG ID";;
*//github.com/* ) email="my-public@email"; name="public name"; gpgid="GPG ID";;
*@corp.com:* ) email="my-corporate@email"; name="real name"; gpgid="GPG same/other ID";;
*//corp.com/* ) email="my-corporate@email"; name="real name"; gpgid="GPG same/other ID";;
esac
```

Expand Down
11 changes: 9 additions & 2 deletions post-checkout
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ cat << INPUT > ~/.git-clone-init
#!/bin/bash

case "\$url" in
*@github.com:* ) email=""; name="";;
*//github.com/* ) email=""; name="";;
*@github.com:* ) email=""; name=""; gpgid="";;
*//github.com/* ) email=""; name=""; gpgid="";;
esac
INPUT
warn "\nMissing file ~/.git-clone-init. Template created..."
Expand All @@ -51,3 +51,10 @@ 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 commit.gpgsign true
git config user.signingkey $gpgid

echo -e "\n Repo configured to use $gpgid GPG Identity"
fi