Created
April 20, 2012 20:47
-
-
Save seveas/2431800 to your computer and use it in GitHub Desktop.
Git config from ldap (/etc/profile.d/gitconfig.sh)
This file contains 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
# Set git user/email based on ldap values | |
test -x /usr/bin/git || return | |
test -x /usr/bin/ldapsearch || return | |
git config --global user.name > /dev/null || { | |
name=$(ldapsearch -x -LLL "(uid=$USER)" cn | sed -ne 's/^cn: //p') | |
test -n "$name" && git config --global user.name "$name" | |
} | |
git config --global user.email > /dev/null || { | |
email=$(ldapsearch -x -LLL "(uid=$USER)" mail| sed -ne 's/^mail: //p') | |
test -n "$email" && git config --global user.email "$email" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment