アカウント毎に公開鍵と秘密鍵を設定、それぞれid_rsa
の名前を特定できるようにする
vi ~/.ssh/config
Host mygit
HostName github.com
User git
Port 22
IdentityFile ~/.ssh/id_rsa_local →ここを変更する
TCPKeepAlive yes
IdentitiesOnly yes
Host othergit
HostName github.com
User git
Port 22
IdentityFile ~/.ssh/id_rsa_other →ここを変更する
TCPKeepAlive yes
IdentitiesOnly yes
git cloneの際に一部変更する
localアカウントの場合
git clone git@github.com:hogehoge/fugafuga.git
↓
git clone mygit:hogehoge/fugafuga.git
otherアカウントの場合
git clone git@github.com:mofumofu/ugauga.git
↓
git clone othergit:mofumofu/ugauga.git