We are in the process of moving from other source/version control methods to git and, because I have no actual experience with git (short of setting some user.* variables), I'd like to ask whether this is a viable direction to take before committing myself down this road.The solution in Is it possible to set the users .gitconfig (for git config --global) dynamically? came close for me but it did not address a situation I discovered using shared service accounts (and which may exist for root, too).I found that User1 would connect and /home/serviceaccount/.gitconfig would get set, then User2 would connect and overwrite that: an execution of git config --global user.name in either session would return User2 details, suggesting the file is referenced at each call.  Because I don't do root, I don't know if this problem exists for two users who sudo to root following @oXiVanisher's solution.To make this dynamic for shared service accounts, a wrapper script rolls in the appropriate .gitconfig based on the user executing it.  The core of it is:#!/bin/shmyuser=`who -m | awk '{ print $1 }'`HOST=`hostname`# atomic locking over NFS via https://unix.stackexchange.com/a/22062LOCKFILE=/local/share/bin/.git.lockTMPFILE=${LOCKFILE}.$$echo $myuser @ $HOST > $TMPFILEif ln $TMPFILE $LOCKFILE 2>&-; then  :else  echo $LOCKFILE detected  echo Script in use by $(<$LOCKFILE)  /bin/rm -f $TMPFILE  exitfitrap /bin/rm -f ${TMPFILE} ${LOCKFILE} 0 1 2 3 15# find my gitconfigCFGFILE=/local/share/DOTfiles/DOTgitconfig.$myuserif [ ! -s $CFGFILE ]; then  echo No personal /local/share/DOTfiles/DOTgitconfig found.  exitfi# roll it incp $CFGFILE $HOME/.gitconfig# execute git/usr/bin/git $@# roll it back in case of changescp $HOME/.gitconfig $CFGFILE# zero it outcat > $HOME/.gitconfig << !# This file intentionally blank for dynamic use# The wrapper script is /local/share/bin/git!When two users are connected to the shared service account, git config --global user.name reports the proper name for each user.  At first blush, this looks like it could make git dynamic for all users sharing one account where environment variables can't be found.But how am I breaking things?  What am I not seeing yet?Thank you.
Dynamic user config for git with wrapper script?
shell script;sudo;git
It seems like your solution would have race conditions (what happens during multiple simultaneous invocations of git?) as well as other problems (such as incorrect use of $* instead of $@.Instead, why don't use just set $GIT_CONFIG in each user's environment to a different file?