git-clone-init icon indicating copy to clipboard operation
git-clone-init copied to clipboard

Git config from LDAP

Open denji opened this issue 7 years ago • 0 comments

# Git config from LDAP (/etc/profile.d/gitconfig.sh)
# 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"
}

denji avatar Jun 27 '18 07:06 denji