- Make some changes in .ssh/config file
Host github-public
HostName github.com
User git
IdentityFile /Users/username/.ssh/id_rsa_public_account
IdentitiesOnly yes
Host github-office
HostName github.com
User git
IdentityFile /Users/username/.ssh/id_rsa
IdentitiesOnly yes
- Make sure that those keys are added into
ssh-agent
.
ssh-agent /paht/to/key_from_public_account
ssh-agent /paht/to/key_from_office
After osx restart those records will gone, so to keep them just call ssh_agent -K <key>
to store it in keychain
- Last step is change repo in
.git/config
[remote "origin"]
url = ssh://git@github-office/path/to/repo.git