3 # skip if env vars are set
4 if [ -n "$GIT_AUTHOR_NAME" -a -n "$GIT_AUTHOR_EMAIL" ]; then
8 # check if configured in ~/.gitconfig
9 email=$(git config --global --get user.email)
10 username=$(git config --global --get user.name)
12 # it's important for each user have their own ~/.gitconfig
13 if [ "$HOME" = "/root" ]; then
16 IMPORTANT: Use 'sudo -s' to become root, so that the $HOME belongs to you not /root
21 if [ -n "$email" -a -n "$username" ]; then
25 user=${SUDO_USER:-$(id -un)}
26 gecos=$(getent passwd $user | cut -d: -f5)
27 email=$user@pld-linux.org
31 Please commit your changes if you modify any files in /etc to git!
32 But before that please setup env vars to identify your commits in your ~/.bash_profile:
34 export GIT_AUTHOR_NAME='$gecos'
35 export GIT_AUTHOR_EMAIL='$email'
37 export GIT_COMMITTER_NAME=\${GIT_COMMITTER_NAME:-\$GIT_AUTHOR_NAME}
38 export GIT_COMMITTER_EMAIL=\${GIT_COMMITTER_EMAIL:-\$GIT_AUTHOR_EMAIL}
40 NOTE: GIT_* vars are imported with sshd so you could setup them where you connect from.
42 You may also use git config, but then you must learn to use 'sudo -s' to become root:
43 git config --global user.email '$email'
44 git config --global user.name '$gecos'
49 # run in subshell not to leak variables
50 git_config_check | cat
51 unset -f git_config_check