How to work with a personal GitHub repo from an office computer whose SSH key has already been added to the work-related GitHub account?

I want to work on my personal GitHub repo from an office computer whose SSH key has already been added to the work-related GitHub account.

In my case, I will not be able to add my personal GitHub account as a co-author for the Job account project. I thought I could add a new key pair on my office computer and add it to my personal GitHub account. But can I work on both the Worker and the Personal repositories in this way? What is the best way to do this?

+3
source share
2 answers

You can add so much in common: the private key you need, the idea is to register them in the% HOME% / file. ssh / config so that you can define remote access to ssh addresses, for example:

workgh:Work persgh:Personal 

See " change github account mac command line " for an example 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 another environment is blatantly deprecated. See this SO question for generating multiple ssh keys non-interactively.

+6
source

Based on the background of Ruby, I ended up using a โ€œgasโ€ ruby โ€‹โ€‹stone. Adding git users was easy, and it takes care of switching git users along with the keys with a simple command on the terminal:

 gas use <nickname> 

Here is this gem link: https://github.com/walle/gas

Video on it: http://www.youtube.com/watch?v=-W2vSTwJWJc

0
source

Source: https://habr.com/ru/post/1442375/


All Articles