Manage multiple github repositories from the same system and different usernames

Background: I have a system, I use it for both hobbies and office projects. I have another github reposition for both places. Ideally, I would like to commit with different usernames. Therefore, I create repositories and local user names: git config --local user.name "Local Name"

The problem occurs when pressing the same ssh keys does not work for both repositories. If I change the ssh key for one repo, this creates problems for me when clicking on another repo using the same ssh keys. How can this be solved?

+4
source share
1 answer

Assuming you are using Linux / Unix, you can set your .ssh/config file to 2 different identifiers

 Host foo foo.example.com Hostname foo.example.com IdentityFile ~/.ssh/foo_rsa Host bar bar.example.org Hostname bar.example.org IdentityFile ~/.ssh/bar_rsa 
0
source

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


All Articles