SSH Keys - TwoGears/hakomo-guides GitHub Wiki

Misc

Copy ssh key

cat ~/.ssh/id_rsa.pub | pbcopy

Create ssh key

ssh-keygen -t rsa

See active ssh keys

ssh-add -l

Activate ssh keys

ssh-add ~/.ssh/your_key

Add permanently key to ssh agent
vim ~/.bash_profile

and then add line inside and restart terminal

ssh-add ~/.ssh/your_key

Heroku

Add key to heroku

heroku keys:add then n then choose key

Bitbucket

Add key to bitbucket
  1. copy your *.pub key through the command above (amazon's was a cer i think)
  2. Go to your Profile->Manage Account->SSH Keys->Add key and paste the copied key
  3. open ~/.ssh/config and add a new account, as per SSH Config instructions
  4. add your remote such that as host you youse the Host, not bitbucket.org to tie the key: git remote add origin git@custom_host_name:/username/repo.git

SSH Config

Adding new account

Open ~/.ssh/config and add

Host custom_host_name
  HostName bitbucket.org
  IdentityFile ~/.ssh/yourkey_filename
  IdentitiesOnly yes

add the key on shell load: vim ~/.bash_profile then add the line ssh-add ~/.ssh/your_key_name restart shell