I want to work on my personal GitHub repo from office computer whose SSH key is already added to a work related GitHub account .
In my case , I will not be able to add my personal GitHub account as a collaborator for "Work" account's project . I was thinking I can add a new key pair on my office computer , and add it to my personal GitHub account . But will I be able to work on both "Work" and "Personal" repos seamlessly that way ? What's the best way to do this ?
You can add as many public:private key you want, the idea being to register them in %HOME%/.ssh/config file, in order for you to define remote with ssh addresses like:
workgh:Work
persgh:Personal
See "change github account mac command line" as an example of an ssh/config
file.
In your case:
#Personal GitHub
Host persgh
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_perso
#Personal Work
Host workgh
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_work
Reusing the same ssh key in different environment is genrally frowned upon.
See this SO question to generate multiple ssh keys non-interactively.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With