Skip to content

Instantly share code, notes, and snippets.

@itsananderson
Created August 27, 2014 22:22
Show Gist options
  • Save itsananderson/97f07ae14ffd6413485b to your computer and use it in GitHub Desktop.
Save itsananderson/97f07ae14ffd6413485b to your computer and use it in GitHub Desktop.
My setup for automatically configuring user.email when cloning a repo
[alias]
email-guess = !. ~/.git-scripts/email-guess.sh
#!/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
#!/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