背景
~/.gitconfig
これはdotfilesとかで管理されるglobalなgitconfig。
1
2
| [include]
path = ~/.gitconfig.local
|
~/.gitconfig.local
これはdotfilesでは管理しないローカルなgitconfig。
1
2
| [includeIf "gitdir:/media/mike/xxx/"]
path = ~/.gitconfig.xxx
|
この例では、あるmediaのxxx以下のgitのフォルダは、gitconfig.xxxを使用するという意味。
~/.gitconfig.xxx
そのある専用のフォルダで使われるgitconfig。
1
2
3
4
5
6
7
| [user]
name = xxx_hoge
email = xxx@hoge
[commit]
gpgsign = false
[core]
sshCommand = ssh -i ~/.ssh/id_xxx_rsa -o IdentitiesOnly=yes
|
gpgはoffにしたり、usernameを変えたり、sshの設定を入れ替えたりしている。
テスト
その特定のフォルダの中でちゃんとworkしているかのテストは以下になる。
1
2
3
4
5
6
7
| cd /medi/mike/xxx
git config --get user.name
xxx_hoge
git config --get user.email
xxx@hoge
|
sshの設定
それ専用に用意する。
1
2
3
4
5
| Host github-hoge
HostName github.com
User git
IdentityFile ~/.ssh/id_xxx
IdentitiesOnly yes
|
Clone:
1
| git clone git@github-hoge:hoge-org/hoge.git
|
まとめ
毎回の儀式。