Skip to content

Instantly share code, notes, and snippets.

@dalzony
Created May 8, 2015 05:06
Show Gist options
  • Save dalzony/0e76af1322cc80b23065 to your computer and use it in GitHub Desktop.
Save dalzony/0e76af1322cc80b23065 to your computer and use it in GitHub Desktop.
프로젝트별로 유저 정보 다르게 하기
#!/bin/bash
#
EMAIL=$(git config --local user.email)
HOST=`echo $(git config remote.origin.url) | awk -F@ '{print $2}' | awk -F: '{print $1}'`
# 로컬 이메일이 없고, 호스트 리모트가 github.com이면
if [ -z "$EMAIL" ]; then
# user.email is empty
if [ "$HOST" == 'github.com' ]; then
git config --local user.name "Name"
git config --local user.email abcd@gmail.com
exit 1
fi
else
# user.email is not empty
exit 0
fi
@dalzony
Copy link
Author

dalzony commented May 8, 2015

프로젝트별이라기 보다 깃헙호스트 주소 다를때

@dalzony
Copy link
Author

dalzony commented May 8, 2015

pre-commit으로 hook에 넣어사용하세용.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment