Created
August 27, 2014 22:22
-
-
Save itsananderson/97f07ae14ffd6413485b to your computer and use it in GitHub Desktop.
My setup for automatically configuring user.email when cloning a repo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
email-guess = !. ~/.git-scripts/email-guess.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
remote=`git remote -v | awk '/\(push\)$/ {print $2}'` | |
[email protected] # default | |
if [[ $remote == *enr.visualstudio.com* ]]; then | |
[email protected] | |
fi | |
if [[ $remote == *itsananderson.visualstudio.com* ]]; then | |
[email protected] | |
fi | |
echo "Configuring user.email as $email" | |
git config user.email $email |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# On Windows this should go in (give or take) C:\Program Files (x86)\Git\share\git-core\templates\hooks | |
# On *nix it's probably /usr/share/git-core/templates | |
# Not sure about OS X | |
if [[ $1 == 00000000000* ]]; then | |
git email-guess | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment