arundhaj

all that is technology

Manage multiple SSH keys for GIT

 

Configuring and managing multiple SSH keys for GIT accounts, in Ubuntu is shown below:

Using ssh-keygen create a public/private key and name it as user1_github, user1_bitbucket

create a file ~/.ssh/config and put the following in it.

# user1 github account
Host user1_github
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/user1_github

# user1 bitbucket account
Host user1_bitbucket
HostName bitbucket.org
PreferredAuthentications publickey
IdentityFile ~/.ssh/user1_bitbucket

Once the configuration is done, you can checkout as below

  $ git clone git@user1_github:user1/my_github_repo.git

  $ git clone git@user1_bitbucket:user1/my_bitbucket_repo.git

Hope this helps!

  GIT

Comments