cd ~/.ssh
ssh-keygen
Press enter to use default file name /Users/<username>/.ssh/id_rsa
.
Set passphrase or leave empty.
Check if indentity file was created:
ls -lsa ~/.ssh
$ ps -e | grep [s]sh-agent
9060 ?? 0:00.28 /usr/bin/ssh-agent -l
$ ssh-agent /bin/bash
$ ssh-add ~/.ssh/id_rsa
Enter passphrase for /Users/emmap1/.ssh/id_rsa:
Identity added: /Users/emmap1/.ssh/id_rsa (/Users/emmpa1/.ssh/id_rsa)
ssh-add
command to list the keys that the agent is managing.$ ssh-add -l
2048 7a:9c:b2:9c:8e:4e:f4:af:de:70:77:b9:52:fd:44:97 /Users/manthony/.ssh/id_rsa (RSA)
id_personal
and id_<companyname>
(E.g id_goodrequest
)From Bitbucket Cloud, choose avatar > Bitbucket settings
In terminal window, copy the contents of your id_personal.pub
identity file that contain public key.
2.1 In Mac OSX, the following command copies the output to the clipboard:
$ pbcopy < ~/.ssh/id_personal.pub
2.2 Copy contents of indentity file in Linux:
$ cat ~/.ssh/id_personal.pub
Paste the copied public key into the SSH Key field.
REPEAT the same process with identity file named id_<companyname>.pub
.
Host bitbucket.personal
User git
HostName bitbucket.org
IdentityFile ~/.ssh/id_personal
IdentitiesOnly yes
Host bitbucket.goodrequest
User git
HostName bitbucket.org
IdentityFile ~/.ssh/id_goodrequest
IdentitiesOnly yes
Host lisa
User ubuntu
HostName 52.29.214.27
IdentityFile ~/.ssh/lisa.pem
IdentitiesOnly yes
Repository ssh adress look like this: git@alias:<accountname>/<reponame>.git
.
When you want to use specific public key replace alias
part of adress with bitbucket.personal
or bitbucket.goodrequest
.