Last active
June 26, 2018 12:23
-
-
Save vgaidarji/49a0d515a3e28563e7fd32917e519fd3 to your computer and use it in GitHub Desktop.
Update Git user name in sub-directories
This file contains hidden or 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
#!/usr/bin/env sh | |
USER_NAME="Veaceslav Gaidarji" | |
USER_EMAIL="[email protected]" | |
echo "Using config: \n user.name=$USER_NAME, \n user.email=$USER_EMAIL\n" | |
for dir in */; | |
do | |
cd $dir | |
# update only if directory is git repo | |
if [ -d .git ] || [ git rev-parse --git-dir > /dev/null 2>&1 ]; then | |
git config user.name "$USER_NAME" | |
git config user.email "$USER_EMAIL" | |
git config commit.gpgsign true | |
echo "Git config updated in $dir" | |
fi; | |
cd .. | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run
git config -l --local
from Git repo folder to check local Git config.Run
git config -l --global
from any folder to check global Git config.Personally, I use local configs per organization, and global for every non-organization project.