Multiple github accounts on the same computer?

后端 未结 25 2564
野的像风
野的像风 2020-11-22 02:56

Trying to work on my both my actual \"work\" repos, and my personal repos on git hub, from my computer.

The work account was set up first, and everything works flawl

25条回答
  •  耶瑟儿~
    2020-11-22 03:47

    The easiest and straightforward approach (IMHO) - no config files not too much hassle

    Just create another ssh key.

    Let's say you have aa new work GitHub account, just create a new key for it:

    sh-keygen -t rsa -C "email@work_mail.com" -f "id_rsa_work_user1"`
    

    Now you should have the old one and the new one, to see them, run:

    ls -al ~/.ssh
    

    You need to run the above only once.

    From now on, every time you want to switch between the two, just run:

    ssh-add -D
    ssh-add ~/.ssh/id_rsa_work_user1 #make to use this without the suffix .pub
    

    In order the switch to the old one, run again:

     ssh-add -D
     ssh-add ~/.ssh/
    

提交回复
热议问题