Set Up Your Default Identity

By default, the system adds keys for all identities to the /Users/yourname/.ssh directory. This procedure creates a default identity. If you have a default identity and you want to use it for Bitbucket, skip this step and go to step 4. If you have an existing default identity but you forgot the passphrase, you can also use this procedure to overwrite your default identity and create a fresh one.

Use the following procedure to create a new default identity.

  • Open a terminal in your local system.
  • Enter ssh-keygen at the command line.
    The command prompts you for a file to save the key in. If the .ssh directory doesn't exist, the system creates one for you.
  • Accept the default location.
  • Enter and re-enter a passphrase when prompted.
    Unless you need a key for a process such as script, you should always provide a passphrase. The command creates your default identity with its public and private keys. The whole interaction will look similar to the following:
    myhost:~ manthony$ ssh-keygen
    Generating public/private rsa key pair.
    Enter file in which to save the key (/Users/manthony/.ssh/id_rsa): 
    Created directory '/Users/manthony/.ssh'.
    Enter passphrase (empty for no passphrase): 
    Enter same passphrase again: 
    Your identification has been saved in /Users/manthony/.ssh/id_rsa.
    Your public key has been saved in /Users/manthony/.ssh/id_rsa.pub.
    The key fingerprint is:
    4c:80:61:2c:00:3f:9d:dc:08:41:2e:c0:cf:b9:17:69 manthony@myhost.local
    The key's randomart image is:
    +--[ RSA 2048]----+
    |*o+ooo.          |
    |.+.=o+ .         |
    |. *.* o .        |
    | . = E o         |
    |    o . S        |
    |   . .           |
    |    .            |
    |                 |
    |                 |
    +-----------------+
            
    
  • List the contents of ~/.ssh to view the key files.
    ls -a ~/.ssh