Skip to content

Instantly share code, notes, and snippets.

@chipcerio
Last active October 7, 2015 01:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chipcerio/180b79a6cb16d05d76fc to your computer and use it in GitHub Desktop.
Save chipcerio/180b79a6cb16d05d76fc to your computer and use it in GitHub Desktop.
# to create SSH key, you do this
# https://help.github.com/articles/generating-ssh-keys/
#
# assuming,
# john.doe@gmail.com is your personal email and
# john.doe@sym.ph is your company email
# $ ssh-keygen -t rsa -b 4096 -C "john.doe@gmail.com"
# create another SSH key for specific company following the above command
$ ssh-keygen -t rsa -f -b 4096 ~/.ssh/id_rsa_symph -C "john.doe@sym.ph"
# add SSH key to ssh-agent
$ ssh-add ~/.ssh/id_rsa_symph
# add SSH key to your other account
$ pbcopy < ~/.ssh/id_rsa_symph.pub
# create config file ~/.ssh/config
Host bitbucket.org
User git
Hostname bitbucket.org
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Host bitbucket-symph
User git
Hostname bitbucket.org
PreferredAuthentications publickey
IdentitiesOnly yes
IdentityFile ~/.ssh/id_rsa_symph
# test the connection
$ ssh -T git@bitbucket-symph
# by default, you clone a project like this
$ git clone git@bitbucket.org:username/project.git
# clone using second bitbucket account
$ git clone git@bitbucket-symph:username/project.git
# http://dbushell.com/2013/01/27/multiple-accounts-and-ssh-keys/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment