キーを作成する
github_private_rsaはお好きなファイル名でどうぞ
ssh-keygen -t rsa -C "your_email@example.com" -f github_private_rsa
sshキーをコピーして2つ目のgithubに登録する
cat ~/.ssh/github_private_rsa.pub | pbcopy
.ssh/configに設定を追加
.ssh/config
Host github-private.com
User git
HostName github.com
IdentityFile ~/.ssh/github_private_rsa
TCPKeepAlive yes
IdentitiesOnly yes
実際にcloneする時に気をつけること
git@github.com:user_name/repository_name.git
となっているものを.ssh/config
で使っているHostに置き換える必要がある
- git@github.com:user_name/repository_name.git
+ git@github-private.com:user_name/repository_name.git
git clone git@github-private.com:user_name/repository_name.git