- Create different SSH Keys for each account. A simple SSH key can be generated using
ssh-keygen -t rsa -C 'email@example.com'
- Create a blank
config
file and include host details as in provided example file. Add an indentifier to differentiate hosts for similar host names.
/Users/hadi/.ssh/
├── config
├── id_rsa_example_enterprise
├── id_rsa_example_enterprise.pub
├── id_rsa_example_personal
├── id_rsa_example_personal.pub
├── id_rsa_github
├── id_rsa_github.pub
└── known_hosts
- Clone repositories with the host changed to the one indicated in the
config
file matching the correct SSH key. For instance, usegit clone git@example.com.enterprise:hadi/something.git
instead ofgit clone git@example.com:hadi/something.git