Posts

How to manage multiple git accounts (Ubuntu/ Mac) | by ByteCode Pandit

Image
Hi, all teach worries, usually, we fall in a situation where we have to use both our personal as well as office GitHub account. So today I am gonna show you how can we manage multiple GitHub account on a machine. For now, I will set up two accounts. Please follow the below steps. Step 1 : Have to create the ssh key for your accounts $ cd ~/.ssh $ ssh-keygen -t rsa -b 4096 -C "peronsal_email_id"  # save as id_rsa_personal $ ssh-keygen -t rsa -b 4096 -C "office_email_id"  # save as id_rsa_office Step 2 : Have to add id_rsa_personal.pub and  id_rsa_office .pub to their respective Github account. Step 3 : Create a config file in the .ssh folder and add the below configs $ touch config  # Personal account - default config  Host github.com-personal    HostName github.com    User git    IdentityFile ~/.ssh/ id_rsa_personal  # Work account   Host github.com-office    HostName github.com    User git   ...