Stash is now known as Bitbucket Server.
See the

Unknown macro: {spacejump}

of this page, or visit the Bitbucket Server documentation home page.

You can use SSH keys to establish a secure connection between your computer and Stash for when you are performing read-only (pull, clone) Git operations from your local machine. Personal keys are attached to your Stash account – they are bound by that account's permissions and use the account's identity for any operations.

Before you can use SSH keys to secure a connection with Stash the following must have already been done:

  • your Stash administrator must have already enabled SSH access in Stash.
  • you need an SSH key! See Creating SSH keys. Alternatively, you can use an existing key, if it isn't already being used as a repository or project access key.
  • you need to have added your personal SSH key to your Stash account – see the following section.

Once you have an SSH key associated with your Stash account, using it is easy! See Use SSH keys to connect to Stash repositories below.

注意:

  • Stash supports DSA and RSA2 key types – RSA1 is not supported. 
  • A Stash user can add any number of keys to their account.
  • You can use the same SSH access key for multiple repositories or projects.
  • Keys used for personal user accounts can't be re-used as a project or repository access key, and keys used as a project or repository access key can't be re-used for user accounts.

Add an SSH key to your Stash account

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

    Windows
    cd %userprofile%/.ssh
    clip < id_rsa.pub


    On Mac OS X or Linux simply run the following in a terminal:

    Mac OS X
    pbcopy < ~/.ssh/id_rsa.pub


    Note that on Linux, you may need to download and install xclip, then use that, as shown in this code snippet:

    Linux
    sudo apt-get install xclip
    xclip -sel clip < ~/.ssh/id_rsa.pub
  2. In Stash, go to your account:


  3. Click on SSH keys and then Add key
  4. Paste the key into the text box: 

  5. Click Add key. You're done!

Use SSH keys to connect to Stash repositories

SSH access needs to have been set up, as described above. Once this is done, you can use SSH keys as follows:

  1. Go to Projects, click a project, and choose a repository from the list.
  2. Click Clone in the sidebar to see the clone URLs for the repository.
  3. Choose the clone URL you want to use. SSH is available if you have already added an SSH key to your account. If you haven't done that yet, see Add an SSH key to your Stash account, above.

  • ラベルなし