Generate SSH key:
$ ssh-keygen -t rsa -C <email1@example.com>
Generate another SSH key
:
$ ssh-keygen -t rsa -f ~/.ssh/accountB -C <email2@example.com>
Now, two public keys (id_rsa.pub, accountB.pub) should be exists in the ~/.ssh/
directory.
$ ls -l ~/.ssh # see the files of '~/.ssh/' directory
Create config file ~/.ssh/config
with the following contents:
$ nano ~/.ssh/config
Host bitbucket.org
User git
Hostname bitbucket.org
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Host bitbucket-accountB
User git
Hostname bitbucket.org
PreferredAuthentications publickey
IdentitiesOnly yes
IdentityFile ~/.ssh/accountB
Clone from default
account.
$ git clone git@bitbucket.org:username/project.git
Clone from accountB
account.
$ git clone git@bitbucket-accountB:username/project.git