git/client: Configure git only for real users

This commit is contained in:
Timo Makinen 2021-05-17 15:48:55 +00:00
parent 5a6da68f2f
commit fd2ee25f29
2 changed files with 14 additions and 10 deletions

View file

@ -1,6 +1,8 @@
if ( "`git config user.name`" == "" ) then
git config --global user.name "`getent passwd '${USER}' | cut -d : -f 5`"
endif
if ( "`git config user.email`" == "" ) then
git config --global user.email "${USER}@{{ mail_domain }}"
if ($uid > 3000 && "`/usr/bin/id -gn`" == "`/usr/bin/id -un`") then
if ( "`git config user.name`" == "" ) then
git config --global user.name "`getent passwd '${USER}' | cut -d : -f 5`"
endif
if ( "`git config user.email`" == "" ) then
git config --global user.email "${USER}@{{ mail_domain }}"
endif
endif

View file

@ -1,6 +1,8 @@
if [ -z "$(git config user.name)" ]; then
git config --global user.name "$(getent passwd "$USER" | cut -d : -f 5)"
fi
if [ -z "$(git config user.email)" ]; then
git config --global user.email "${USER}@{{ mail_domain }}"
if [ $UID -gt 3000 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; then
if [ -z "$(git config user.name)" ]; then
git config --global user.name "$(getent passwd "$USER" | cut -d : -f 5)"
fi
if [ -z "$(git config user.email)" ]; then
git config --global user.email "${USER}@{{ mail_domain }}"
fi
fi