リポジトリのクローン

robotsnoindex

リポジトリをクローンすると、リポジトリがローカル マシンに同期されます。クローン後、ファイルを追加/編集してから、更新をプッシュ/プルできます。 

この記事はコマンド ラインについて説明します。コマンド ライン操作に馴染みが薄い場合、お使いのオペレーティング システムのビデオ チュートリアルをご確認ください。

Git リポジトリのクローン

Sourcetree、コマンド ラインの Git、または任意のクライアントを使用して Git リポジトリをクローンできます。以下は、ターミナルから Git を使用してリポジトリをクローンする方法の手順です。

  1. リポジトリのグローバル サイドバーで + をクリックして、[作業に取りかかりましょう] の下の [このリポジトリをクローン] を選択します
  2. clone コマンドをコピーします (SSH または HTTPS 形式)。SSH プロトコルを使用している場合、公開キーが Bitbucket に追加されていて、クローンを行うローカル システムに読み込まれていることを確認します。
  3. ターミナル ウィンドウで、リポジトリをクローンするローカル ディレクトリに移動します。
  4. Bitbucket からコピーしたコマンドを貼り付けます。以下に例を示します。

    HTTPS 経由でのクローン
    $ git clone https://username@bitbucket.org/teamsinspace/documentation-tests.git

    SSH 経由でのクローン
    $ git clone ssh://git@bitbucket.org:teamsinspace/documentation-tests.git

クローンが成功すると、リポジトリをクローンしたディレクトリのローカル ドライブに新しいサブディレクトリが表示されます。このディレクトリは、クローンした Bitbucket リポジトリと同じ名前になります。クローンには、ソース ファイルに加えた変更を保持するために Git が必要とする、ファイルとメタデータが含まれます。

Sourcetree を使用してリポジトリをクローンする

You can also use Sourcetree to clone your repository. If you aren't familiar with Sourcetree, it's our client that provides an alternative to the command line. Follow these instructions to clone your repository. If you don't have SourceTree, download the application first.

  1. From the repository, select the Clone button.
  2. In the Clone this repository dialog, select the Clone in Sourcetree button.
  3. 必要に応じて、[宛先パス] または [ブックマーク名] を更新します。
    [宛先パス] は、クローンがローカル システムに保存するフォルダです。[ブックマーク名] は、そのフォルダの名前です。
    この時点で、ダイアログは次のようになります。
  4. [クローン] をクリックします。
    Sourcetree によって、ローカル システムにフォルダが作成されます。Sourcetree を使用してリポジトリを操作できます。
    1. Branches list: Lists your Git branches.
    2. ファイル リスト: リポジトリ内のすべてのファイルが含まれます。
    3. 操作ボタン: リポジトリを操作できます。
    4. コミット リスト: リポジトリへのコミットの一覧と各コミットの詳細が含まれます。
    5. 選択したファイル: 選択されたファイルの差分を示します。

Clone a repository using VS Code

You can also use Virtual Studio (VS) Code to clone your repository. If you aren't familiar with VS Code, it's a source code editor developed by Microsoft that provides an alternative to the command line. Follow these instructions to clone your repository. If you don't have Visual Studio Code, download the application first.

  1. From the repository, select the Clone button.
  2. Copy only the URL portion of the 'git clone' command provided in the Clone this repository dialog. For example, HTTPS formathttps://username@bitbucket.org/username/vscode_clone.git or SSH format - git@bitbucket.org:username/vscode_clone.git.
  3. In the Clone this repository dialog, select the Clone in VS Code button.
  4. Open Visual Studio Code.
  5. In VS Code, press Ctrl (or Command) + Shift + P.

  6. Enter Git Clone in the search field at the top of the page.

  7. Paste the URL of the repository you copied in Step 2.

  8. When prompted, select the local storage location where you want to keep the cloned repository. 

  9. Select the Select repository location button.
  10. You repository will be cloned and stored in the location you chose. You can then open the repository and begin working on it in VS Code.

You may be prompted to log in to your Bitbucket Cloud account so VS Code can access the necessary data to clone your repository.




Last modified on Mar 22, 2021

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.