forgot password?   register

Mac OS X SSH Setup


Step 1

Check to see if you already have a public/private key pair for your user. If you do, it will be in your ~/.ssh directory.

[~]$ cd .ssh
[~/.ssh]$ ls
config        id_rsa.pub
id_rsa        known_hosts

Key pairs are always named like something and something.pub. The something file is your private key and must be kept secret. The something.pub file is your public key, and this is what you'll be giving us. If you already have a key pair (in the above listing I have an id_rsa key pair) and you want to use it for Patch-Tag, then skip to Step 3.

Step 2

If you don't have any keys yet, then you'll need to generate them. This can be done with the ssh-keygen program.

[~/.ssh]$ ssh-keygen

Generating public/private rsa key pair.
Enter file in which to save the key (/Users/tom/.ssh/id_rsa): <enter>
Enter passphrase (empty for no passphrase): <enter password>
Enter same passphrase again: <enter password again>
Your identification has been saved in /Users/tom/.ssh/id_rsa.
Your public key has been saved in /Users/tom/.ssh/id_rsa.pub.
The key fingerprint is:
50:43:77:c6:97:af:61:82:dc:ea:9b:6b:67:d4:1b:61 tom@volcano

You are free to name your key pair whatever you like. Just make sure you copy the correct public key in the next step. The password that you enter will be requested from you every time you push or pull from a private repo. You can use ssh-agent or the built-in keychain support in Leopard to automate password entry (ssh-add ~/.ssh/id_rsa).

Step 3

Copy your public key to the clipboard so you can easily paste it into your web browser.

[~/.ssh]$ cat id_rsa.pub | pbcopy

The pbcopy command copies whatever is sent to it via STDIN to the clipboard, ensuring that you won't have any extraneous newlines or other problems. Now go to your ssh keys and paste in your public key!

Problems?

The steps above didn't work for me. I found that this openssh guide helped me out. The missing parts (i think) were:

  1. `chmod 600 .pub' after creation.
  2. `ssh-add ' in my shell.

I debugged the connection by just trying a pure ssh connection to patch-tag:

`ssh -vi ~/.ssh/id_rsa username@patch-tag.com'

I needed to create a config file in the .ssh directory containing the following to point to the relevant IdentityFile:


Host patch-tag.com
  User username
  Port 22
  Hostname patch-tag.com
  IdentityFile ~/.ssh/id_rsa
  TCPKeepAlive yes
  IdentitiesOnly yes



(adapted from github.com)