.gitconfig
で、user.nameとuser.emailを会社と個人で使い分けたい場合の例を紹介します。
~/.gitconfig
の末尾に以下を挿入すると、あるリポジトリのみは会社のアカウントの設定でgitを利用できます。
[includeIf "gitdir:~/dev/src/bitbucket.org/company/"]
path = ~/dev/src/bitbucket.org/company/.gitconfig
そして、会社のリポジトリ(ここでいうcompany/
以下)の配下に.gitconfigを作り、会社用のuser.nameとuser.emailを追記します。
[user]
name = junpeko_company
email = [email protected]
includeIf
で、ある条件の場合は、こちらを読み込んでねという設定ができます。