Giter Club home page Giter Club logo

multiple_github_accounts's Introduction

Multiple_Github_accounts

How to use multiple github accounts in VS code to push and pull from repositories Ex : first account is in : [email protected] second account is in : [email protected]

Step-1 : Terminal

Open the terminal from the start bar.

Step-2 : SSH

Move to shell using : cd ~/.ssh

The cd ~/.ssh command is used to change the current working directory to the .ssh directory that is located in the user's home directory.

The tilde ~ in the command is a shorthand notation for the user's home directory, so ~/.ssh refers to the .ssh directory that is located in the home directory.

The .ssh directory is used for storing SSH-related files, such as public and private keys, known hosts, and configuration files. When you run the cd ~/.ssh command, you are changing the current working directory to this directory, which allows you to perform operations on these SSH-related files, such as generating or managing SSH keys, configuring SSH connections, and so on.

Step-3: Command to create ssh key

ssh-keygen -t rsa -b 4096 -C "[email protected]" ssh-keygen -t rsa -b 4096 -C "[email protected]"

Step-4: Enter file in which to save the key

While doing the third step you have to enter the rsa file name in which you wish to save the key. We are renaming it to different names for the different accounts. Set file name for user 1 = id_rsa_user1.pub Set file name for user 2 = id_rsa_user2.pub

Step-5: Get the Public Key for both the accounts

cat id_rsa_user2.pub

Copy this public key and paste in the github account SSH Key section. Do this for both the accounts

Step-6: Create the config file

nano config

# Personal account - default config
Host github.com
   HostName github.com
   User git
   IdentityFile ~/.ssh/id_rsa_user1
# Practise account
Host github.com-user2
   HostName github.com
   User git
   IdentityFile ~/.ssh/id_rsa_user2

Step-7: Clone the repo using the SSH option from the Code section of the repository

If you are cloning using your default config id then you just simply need to copy the link and do git clone. git clone [email protected]:puspaul/twitter-the-algorithm.git

If you want to use your secondary account to clone then just add the user2 id after github.com with the name we changed in the config file.

git clone [email protected]:puspaul/twitter-the-algorithm.git

Step-8: Add, Commit, Push

The add, commit and push functionalities remain same as before. The cloned repositories know from backend which id is pushing or adding and we dont need to add the identifiers at every step, just do it once during cloning and you are done.

multiple_github_accounts's People

Contributors

puspaul avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.