Git

git commit 이메일 주소 분리

Bong Gu 2020. 12. 16. 23:14
728x90

git commit 이메일 주소 분리

  • 회사 계정 과 본인 계정을 디렉토리별로 다른 계정으로 commit 을 남기고 싶을때

  • global list 조회

  git config --global --list

  ## response
  user.name=choiyongrack
  user.email=yrchoi@rsupport.com
  • 현재는 회사계정으로 기본 계정정보가 설정되어있다.

    • ~/Bong/* 의 경로 및 ~/Dropbox/Develop/* 의 경로는 본인의 깃헙 계정으로 commit 메세지를 남기고 싶다. (자동으로)

    • gitconfig 파일 수정

  vim ~/.gitconfig

  ## 추가
  [includeIf "gitdir:~/Bong/"]
          path = .gitconfig-bong
  [includeIf "gitdir:~/Dropbox/Develop/"]
          path = .gitconfig-bong
  • gitconfig-bong 파일 생성
  vim ~/.gitconfig-bong

  ## 입력
  [user]
          email = jipsyer@naver.com
          name = cyr9210
  [github]
          user = cyr9210
  • global list 재조회
  git config --global --list

  ## response
  user.name=choiyongrack
  user.email=yrchoi@rsupport.com
  includeif.gitdir:~/Bong/.path=.gitconfig-bong
  includeif.gitdir:~/Dropbox/Develop/.path=.gitconfig-bong

참고


728x90