戻る

目次

Bitbucketとは

  • Free source code hosting for Git and Mercurial by Bitbucket
    「Mercurial」または「Git」のリモートリポジトリを管理できるホスティングサービス
    無料のアカウントでプライベートリポジトリを無制限に生成する事が出来、同時に5ユーザーまで使用する事が出来ます
    ※別途有料プランもあります

秘密鍵・公開鍵を作る

Bitbucket との通信を暗号化するために、秘密鍵・公開鍵を作成する必要があります。

1.OpenSSHの秘密鍵・公開鍵を作る

  1. デスクトップにある[Git Bash]ショートカットをクリック
  2. 以下のコマンドを実行
    ssh-keygen -t rsa
  3. 以下の様にファイル名を聞いてくるのでEnterを押す
    ※表示されているフォルダにid_resという名前で生成される
    Generating public/private rsa key pair.
    Enter file in which to save the key (/c/Users/(ユーザーID)/.ssh/id_rsa):
    ※ここで好きなファイル名を入力する事が出来ますが、そうした場合は何故か「.ssh」フォルダが作られません
  4. 鍵を使うためのパスワードを設定する
    ※ここで設定したパスワードは後で何度も使うのでメモして下さい
    Enter passphrase (empty for no passphrase):
  5. もう一度同じパスワードを入力する
    Enter same passphrase again:
  6. 以下のフォルダに秘密鍵(id_rsa)と公開鍵(id_rea.pub)が生成される
    C:\Users\(ユーザー名)\.ssh\
    C:\Documents and Settings\(ユーザー名)\.ssh\
    ※ファイル名を指定した場合は以下のフォルダに生成されます
    C:\Users\(ユーザー名)\
    C:\Documents and Settings\(ユーザー名)\

2.OpenSSHの秘密鍵からPutty形式の公開鍵を作成

  1. [スタート] ボタンをクリックします。

    #ref(): File not found: "OpenSSH_PuttyPublicKeyCreate001.png" at page "Git/Bitbucketのリモートリポジトリを使う"

  2. [すべてのプログラム] をクリックします。

    #ref(): File not found: "OpenSSH_PuttyPublicKeyCreate002.png" at page "Git/Bitbucketのリモートリポジトリを使う"

  3. [TortoiseGit] をクリックします。

    #ref(): File not found: "OpenSSH_PuttyPublicKeyCreate003.png" at page "Git/Bitbucketのリモートリポジトリを使う"

  4. [Puttygen] をクリックします。

    #ref(): File not found: "OpenSSH_PuttyPublicKeyCreate004.png" at page "Git/Bitbucketのリモートリポジトリを使う"

  5. [File] メニューの [Load private key] をクリックします。

    #ref(): File not found: "OpenSSH_PuttyPublicKeyCreate005.png" at page "Git/Bitbucketのリモートリポジトリを使う"

  6. [ファイルの種類] コンボ ボックスをクリックします。

    #ref(): File not found: "OpenSSH_PuttyPublicKeyCreate006.png" at page "Git/Bitbucketのリモートリポジトリを使う"

  7. [ファイルの種類] コンボ ボックスリストの [All Files (*.*)] をクリックします。

    #ref(): File not found: "OpenSSH_PuttyPublicKeyCreate007.png" at page "Git/Bitbucketのリモートリポジトリを使う"

  8. OpenSSHの秘密鍵のファイル(拡張子無し)を選択します。

    #ref(): File not found: "OpenSSH_PuttyPublicKeyCreate008.png" at page "Git/Bitbucketのリモートリポジトリを使う"

  9. [開く] ボタンをクリックします。

    #ref(): File not found: "OpenSSH_PuttyPublicKeyCreate009.png" at page "Git/Bitbucketのリモートリポジトリを使う"

  10. OpenSSHの鍵を作成した際に設定したパスワードを入力します。

    #ref(): File not found: "OpenSSH_PuttyPublicKeyCreate010.png" at page "Git/Bitbucketのリモートリポジトリを使う"

  11. [OK] ボタンをクリックします。

    #ref(): File not found: "OpenSSH_PuttyPublicKeyCreate011.png" at page "Git/Bitbucketのリモートリポジトリを使う"

  12. メッセージ ボックスで、 [OK] ボタンをクリックします。

    #ref(): File not found: "OpenSSH_PuttyPublicKeyCreate012.png" at page "Git/Bitbucketのリモートリポジトリを使う"

  13. [Save public key] ボタンをクリックします。

    #ref(): File not found: "OpenSSH_PuttyPublicKeyCreate013.png" at page "Git/Bitbucketのリモートリポジトリを使う"

  14. [ファイル名] コンボ ボックスリストの [ファイル名] ボックスに 「(任意のファイル名).ppk] と入力します。

    #ref(): File not found: "OpenSSH_PuttyPublicKeyCreate014.png" at page "Git/Bitbucketのリモートリポジトリを使う"

  15. [保存] ボタンをクリックします。

    #ref(): File not found: "OpenSSH_PuttyPublicKeyCreate015.png" at page "Git/Bitbucketのリモートリポジトリを使う"

  16. Putty形式の公開鍵(*.ppk)が作成されます
    この鍵はTortoiseGitによるリポジトリのクローン時に使います

Bitbucketのリポジトリを使う

  1. あらかじめ、Bitbucketのアカウントを作成してログインしておきます。
  1. 公開鍵(id_rea.pub)をリモートリポジトリがある環境に設定する
    ※設定方法はGitホスティングサービスのサイト内のドキュメントか、サーバーの管理者に聞いて下さい