ディレクトリ構成とファイル
$ tree ~/.ssh ~/.ssh ├── github_private └── github_company
~/.gitconfig
[color] ui = true [includeIf "gitdir:~/misc/dev/git/private/"] path = ~/misc/dev/git/private/.gitconfig [includeIf "gitdir:~/misc/dev/git/company/"] path = ~/misc/dev/git/company/.gitconfig
~/misc/dev/git/private/.gitconfig
[user] name = private-name email = private@example.com [core] sshCommand = ssh -i ~/.ssh/github_private -o IdentitiesOnly=yes -F /dev/null
~/misc/dev/git/company/.gitconfig
[user] name = company-name email = company@example.com [core] sshCommand = ssh -i ~/.ssh/github_company -o IdentitiesOnly=yes -F /dev/null
として、作業ディレクトリは
~/misc/dev/git/private
と
~/misc/dev/git/company
になり
そこでgit cloneとかすると勝手に鍵を使い分けてくれる