# Stash Latest : Setting up SSH on Windows

This page last changed on Jun 14, 2012 by pwatson.

You can use SSH keys to establish a secure connection between your computer and Stash for when you are performing Git operations. There are a few steps to set up SSH keys for Stash, but it's quite straightforward, so follow along. If you already have a key you want to use, go to step 4.
| Your Stash administrator must have already enabled SSH access to Git repositories. Supported key types are DSA and RSA2. RSA1 is not supported.
| On this page: 1. Check for existing SSH keys 2. Back up old SSH keys 3. Generate a new SSH key 4. Add an SSH key to Stash Related pages: Setting up SSH on Linux and Mac Setting up SSH port forwarding Permanently authenticating with Git repositories

### 1. Check for existing SSH keys

You should check for existing SSH keys on your local computer. If you already have a key pair that you want to use, you can go to step 4.

Open a command prompt, and run the following:

    cd ~/.ssh

- If you see "No such file or directory, then there aren't any existing keys: go to step 3.

- Check to see if you have a key already:

      dir id_*

- If there are existing keys, you may want to use them: go to step 4.

### 2. Back up old SSH keys

If you have existing SSH keys, but you don't want to use them when connecting to Stash, you should back those up.

Do this in a command prompt on your local computer, by running:

    mkdir key_backup
    cp id_rsa* key_backup

Now generate a new SSH key.

### 3. Generate a new SSH key

If you don't have an existing SSH key to use, you need to generate one.

1. Log in to your local computer as an administrator.

2. Open a command prompt, and run the following:

       ssh-keygen

   Note that the `ssh-keygen` command is only available if you have already installed Git (with Git Bash).
   You'll see a response similar to this:

3. Just press <Enter> to accept the default location and file name. If the `.ssh` directory doesn't exist, the system creates one for you.

4. Enter, and re-enter, a passphrase when prompted. The whole interaction will look similar to this:

5. You're done! Now add the new key to Stash.

### 4. Add an SSH key to Stash

1. In your command prompt, change directory to the .ssh directory, and copy the public key file to your clipboard, by running:

       cd .ssh
       clip < id_rsa.pub

2. In Stash, go to your profile:

3. Click on SSH Keys and then Add Key:
4. Paste the key into the text box:
5. Click Add Key. You're done!

## Attachments:

STASH_11_win_keygen_1.png (image/png)
STASH_11_win_keygen_2.png (image/png)
STASH_11_win_keygen_2.png (image/png)
win-keygen-5.png (image/png)
Stash_1_1_windows_keygen.png (image/png)