Skip to content

Instantly share code, notes, and snippets.

@chipcerio
Last active October 7, 2015 01:47
Show Gist options
  • 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,
# [email protected] is your personal email and
# [email protected] is your company email
# $ ssh-keygen -t rsa -b 4096 -C "[email protected]"
# create another SSH key for specific company following the above command
$ ssh-keygen -t rsa -f -b 4096 ~/.ssh/id_rsa_symph -C "[email protected]"
# 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 [email protected]: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