
IdentitiesOnly yes にして、 IdentityFile は個別で指定したほうがいい件
sshの設定はすべて ~/.ssh/config で済ませたい派で、共通化したい設定はすべて Host * でまとめておけばいい とばかり思ってたけど、問題に当たったのでメモ。 つまり、IdentityFileの行は重複するけど、個別に設定すべし ~/.ssh/config Host * IdentitiesOnly yes Host github.com HostName github.com User git IdentityFile ~/.ssh/id_rsa Host sub.github.com HostName github.com User git IdentityFile ~/.ssh/id_rsa_sub SSHの接続先が多いがすべて同じ鍵で接続できていたので、以下の様に設定していた。 ~/.ssh/config Host * # ここに鍵設定 IdentityFile ~/.ssh/id_rsa IdentitiesOnly yes Host example HostName example.com User example そこで、GitHubのアカウトを複数扱う必要があり、鍵設定がいることになり、以下のように設定したとする ~/.ssh/config Host * IdentityFile ~/.ssh/id_rsa IdentitiesOnly yes Host example HostName example.com User example Host github.com HostName github.com User git Host sub.github.com HostName github.com User git # このケースだけ違う鍵を使いたい IdentityFile ~/....