8
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Stashでsshを利用した接続を行う

8
Last updated at Posted at 2013-07-18

Attlassian社から提供されるStash はgitでSSHを利用して接続する方法が設定可能です。
しかしながらその設定方法が微妙に分かりづらいので、SSH鍵の作成からStash上でのSSH公開鍵登録を行い、 git clone を行うまでの手順を記述します。

ssh鍵の作成

ssh-keygen を実行してssh鍵を設定します。

localhost@root:.ssh $ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/root/.ssh/id_rsa.
Your public key has been saved in /Users/root/.ssh/id_rsa.pub.
The key fingerprint is:
c3:d5:3d:4c:1e:33:4c:57:26:1f:3e:c1:5f:04:a7:69 root@localhost
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|         . .     |
|          + . . .|
|         . . . = |
|        S   = E .|
|         . + B.o |
|          = + +oo|
|         . o . o=|
|               .o|
+-----------------+

結果id_rsaと'id_rsa.pub'が生成されます。


## StashでSSH接続を許可する。

`Settings`から`Server settings`を選択します。

![kobito.1374119656.956094.png](https://qiita-image-store.s3.amazonaws.com/0/11214/e87b4e44-eef2-32f4-8d8d-cc704a52ebf6.png "kobito.1374119656.956094.png")

`SSH access` が有効になっている事を確認します。

![kobito.1374119737.626081.png](https://qiita-image-store.s3.amazonaws.com/0/11214/4af15811-a201-4cee-16e7-a904eab01964.png "kobito.1374119737.626081.png")

## Stash上へSSH公開鍵の登録
右上の個人画像から `Manage account` を選択します。
![kobito.1374056672.678438.png](https://qiita-image-store.s3.amazonaws.com/0/11214/030c3513-5f12-9c78-4384-fe316298f1c2.png "kobito.1374056672.678438.png")

`SSH Keys` を選択します。
![capture 2013-07-17 19.30.15.png](https://qiita-image-store.s3.amazonaws.com/0/11214/b2a778bc-2a1e-1cc5-ecb5-059d3e03ee4a.png "capture 2013-07-17 19.30.15.png")

`id_rsa.pub` の内容をコピーしKeyとして貼付けます。
![capture 2013-07-17 19.31.46.png](https://qiita-image-store.s3.amazonaws.com/0/11214/8b11eca0-ab07-db63-9740-09ccaab6c197.png "capture 2013-07-17 19.31.46.png")

すると、リポジトリのcloneをする際に、 `SSH``HTTP` の指定を選べるようになります。

![kobito.1374119576.860093.png](https://qiita-image-store.s3.amazonaws.com/0/11214/09235de4-d22b-3812-1458-2168387c9b19.png "kobito.1374119576.860093.png")

以上です。

## 参考サイト

* [Using SSH for Git operations](https://confluence.atlassian.com/display/STASH/Using+SSH+for+Git+operations)
8
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?